Re: BUG #15198: nextval() accepts tables/indexes when adding adefault to a column
От | Peter Eisentraut |
---|---|
Тема | Re: BUG #15198: nextval() accepts tables/indexes when adding adefault to a column |
Дата | |
Msg-id | f0ca3887-aa58-4f55-fcc4-3d49a986e15c@2ndquadrant.com обсуждение исходный текст |
Ответ на | BUG #15198: nextval() accepts tables/indexes when adding a default toa column (PG Bug reporting form <noreply@postgresql.org>) |
Ответы |
Re: BUG #15198: nextval() accepts tables/indexes when adding adefault to a column
Re: BUG #15198: nextval() accepts tables/indexes when adding a default to a column |
Список | pgsql-bugs |
On 5/16/18 05:29, PG Bug reporting form wrote: > bugtest=# CREATE TABLE demo(i int default nextval('demo') PRIMARY KEY); > CREATE TABLE > bugtest=# ALTER TABLE demo ADD COLUMN j int default nextval('demo_pkey'); > ALTER TABLE > bugtest=# \d demo > Table "public.demo" > Column | Type | Collation | Nullable | Default > --------+---------+-----------+----------+-------------------------------- > i | integer | | not null | nextval('demo'::regclass) > j | integer | | | nextval('demo_pkey'::regclass) > Indexes: > "demo_pkey" PRIMARY KEY, btree (i) > > bugtest=# INSERT INTO demo (i, j) VALUES (1,1); > INSERT 0 1 > bugtest=# INSERT INTO demo (i, j) VALUES (DEFAULT, DEFAULT); > ERROR: 42809: "demo" is not a sequence > LOCATION: init_sequence, sequence.c:1139 You are right that this is not optimal behavior. I'm not sure if it's worth fixing, however. (Introduce a regsequence type to use in place of regclass?) -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
В списке pgsql-bugs по дате отправления: