Postgres: Incorrect Syntax Generated for DROP COLUMN on VIEW
- Dominant language
- Java
- Stars
- 51.8k
- Forks
- 4.4k
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 189
Description
### Description
On Postgres, dropping a column on a view generates:
ALTER VIEW results."v1_resultSetModels" DROP COLUMN foo;
[Should be](https://www.postgresql.org/docs/current/sql-alterview.html):
ALTER VIEW results."v1_resultSetModels" alter COLUMN "foo" drop default;
### DBeaver Version
23.2.0.202309120446
### Operating System
Windows
### Database and driver
PostgreSQL 13.4 on x86_64-redhat-linux-gnu, compiled by gcc (GCC) 11.2.1 20211203 (Red Hat 11.2.1-7), 64-bit
PostgreSQL JDBC Driver 42.5.2
### Steps to reproduce
create view "pants" as select 1 as "something", 2 as "something else"
Use dBeaver to list the view columns and then try and delete the column 'something else':
The code generated will be:
ALTER VIEW public.pants DROP COLUMN "something else";
...and will fail; whereas it should be:
alter view "pants" alter column "something else" drop default
### Additional context
Pro-tip: Dropping "pants" in "public" will _generally_ get you arrested. So, don't do that. :)
Contributor guide
Research direction
No source files, tests, or entry points are named. Reproduce the view-column deletion against PostgreSQL 13.4 using the SQL in the report, then trace the DBeaver code that generates the ALTER VIEW statement; done means the generated statement uses the reported ALTER COLUMN ... DROP DEFAULT form and succeeds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, postgresql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100