pgadmin-org / pgadmin4

pgAdmin is the most popular and feature rich Open Source administration and development platform for PostgreSQL, the most advanced Open Source database in the world.
https://www.pgadmin.org
Other
2.53k stars 656 forks source link

Script -> CREATE Script generates wrong Code for autoincrement columns, (e.g. 'bigserial') (RM #1956) #803

Closed dpage closed 2 years ago

dpage commented 8 years ago

Issue migrated from Redmine: https://redmine.postgresql.org/issues/1956 Originally created by Solo Man at 2016-11-13 12:56:38 UTC.

Script -> CREATE Script in pgAdmin3 created something like this:

CREATE TABLE table_test1
(
  id bigserial NOT NULL,
...

pgadmin4 instead creates something like this:

CREATE TABLE public.table_test1

(
    id bigint NOT NULL DEFAULT nextval('table_test1_id_seq'::regclass),
    CONSTRAINT table_test1_pkey PRIMARY KEY (id)
)

which will always fail because relation 'table_test1_id_seq' does not exist!

dpage commented 7 years ago

Comment migrated from Redmine: https://redmine.postgresql.org/issues/1956#note-1 Originally created by Murtuza Zabuawala at 2017-06-07 13:15:13 UTC.

Hi Dave,

As per our discussion https://www.postgresql.org/message-id/CA+OCxoxqJrnB=b7LaUasUH_wUAh=mRZJdki8fQkayGq3EH5jGA@mail.gmail.com

As what user is getting in CREATE script is expected behaviour in pgAdmin4, so can we close this ticket?

Redmine ticket header update:

Name Old Value New Value
Assigned To changed Dave Page
dpage commented 6 years ago

Comment migrated from Redmine: https://redmine.postgresql.org/issues/1956#note-2 Originally created by Dave Page at 2018-05-11 10:32:01 UTC.

I think we need to investigate if it's now feasible to re-generate the SQL using the serial/bigserial types, as that would definitely be nicer.

dpage commented 6 years ago

Comment migrated from Redmine: https://redmine.postgresql.org/issues/1956#note-3 Originally created by Dave Page at 2018-05-18 10:58:24 UTC.

Redmine ticket header update:

Name Old Value New Value
Assigned To changed Dave Page
dpage commented 6 years ago

Comment migrated from Redmine: https://redmine.postgresql.org/issues/1956#note-4 Originally created by Akshay Joshi at 2018-07-20 10:56:49 UTC.

Redmine ticket header update:

Name Old Value New Value
Sprint changed Ready
dpage commented 5 years ago

Comment migrated from Redmine: https://redmine.postgresql.org/issues/1956#note-5 Originally created by Akshay Joshi at 2019-10-11 10:24:06 UTC.

Redmine ticket header update:

Name Old Value New Value
Relationship (duplicates) changed RM #4146
dpage commented 5 years ago

Comment migrated from Redmine: https://redmine.postgresql.org/issues/1956#note-6 Originally created by Akshay Joshi at 2019-10-11 10:24:40 UTC.

This is not a bug. serial and bigserial are not types in PostgreSQL, they are shorthand for int/bigint with a default value from a sequence. There's no reliable way for pgAdmin to tell if a column was originally created as a serial.

Redmine ticket header update:

Name Old Value New Value
Status changed New Rejected
dpage commented 2 years ago

Issue closed on Redmine.