Обсуждение: BUG #17298: Error in func pg_get_serial_sequence()

Поиск
Список
Период
Сортировка

BUG #17298: Error in func pg_get_serial_sequence()

От
PG Bug reporting form
Дата:
The following bug has been logged on the website:

Bug reference:      17298
Logged by:          Serge Salamatin
Email address:      salamsp@gmail.com
PostgreSQL version: 13.5
Operating system:   Ubuntu 13.5-2.pgdg20.04+1
Description:

CREATE SEQUENCE IF NOT EXISTS tnd.ui_seq
    INCREMENT 1
    START 1
    MINVALUE 1
    MAXVALUE 9223372036854775807
    CACHE 1;

CREATE TABLE IF NOT EXISTS tnd.xdwdef
(
    defnm citext COLLATE pg_catalog."default" NOT NULL,
    ui_id bigint NOT NULL DEFAULT nextval('tnd.ui_seq'::regclass),
    def citext COLLATE pg_catalog."default",
    CONSTRAINT defnm_pk PRIMARY KEY (defnm)
)

;
select pg_get_serial_sequence('tnd.xdwdef','ui_id');

returns null


Re: BUG #17298: Error in func pg_get_serial_sequence()

От
"David G. Johnston"
Дата:
On Thursday, November 25, 2021, PG Bug reporting form <noreply@postgresql.org> wrote:
The following bug has been logged on the website:

Bug reference:      17298
Logged by:          Serge Salamatin
Email address:      salamsp@gmail.com
PostgreSQL version: 13.5
Operating system:   Ubuntu 13.5-2.pgdg20.04+1
Description:       

CREATE SEQUENCE IF NOT EXISTS tnd.ui_seq
    INCREMENT 1
    START 1
    MINVALUE 1
    MAXVALUE 9223372036854775807
    CACHE 1;

CREATE TABLE IF NOT EXISTS tnd.xdwdef
(
    defnm citext COLLATE pg_catalog."default" NOT NULL,
    ui_id bigint NOT NULL DEFAULT nextval('tnd.ui_seq'::regclass),
    def citext COLLATE pg_catalog."default",
    CONSTRAINT defnm_pk PRIMARY KEY (defnm)
)

;
select pg_get_serial_sequence('tnd.xdwdef','ui_id');

returns null



This isn’t a bug.  You choose not to use the serial pseudo-type and then did not perform all of the steps that needed to be done to make an equivalent setup.  In particular, you didn’t make the manually created sequence owned by the table.

David J.