pg_catalog.pg_get_serial_sequence() returns NULL
От | Sergey Karin |
---|---|
Тема | pg_catalog.pg_get_serial_sequence() returns NULL |
Дата | |
Msg-id | b78883bf0706260828u67cc1264h541ff1316464cc55@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: pg_catalog.pg_get_serial_sequence() returns NULL
|
Список | pgsql-general |
Hi!
I use PG 8.1.5
I execute in psql next comands:
create table t_table (gid serial, name varchar);
select pg_catalog.pg_get_serial_sequence('t_table', 'gid');
pg_get_serial_sequence
------------------------
public.t_table_gid_seq
create table t_table_1() inherits (t_table);
\d t_table_1
Table "public.t_table_1"
column | Type | Модификаторы
---------+-------------------+-------------------------------------------------------
gid | integer | not null default nextval('t_table_gid_seq'::regclass)
name | character varying |
Inherit: t_table
select pg_catalog.pg_get_serial_sequence('t_table_1', 'gid');
pg_get_serial_sequence
------------------------
<NULL>
How I can get name of sequence used by gid column of partition table? And why for t_table_1 pg_get_serial_sequence() returns NULL?
It returns NULL also if I create new sequence manually and use ALTER TABLE ALTER COLUMN <column> SET DEFAULT nextval(<my_new_sequence>::regclass).
In http://www.postgresql.org/docs/8.1/static/datatype.html#DATATYPE-SERIAL I can read that type SERIAL is equivalent to
Sergey Karin
I use PG 8.1.5
I execute in psql next comands:
create table t_table (gid serial, name varchar);
select pg_catalog.pg_get_serial_sequence('t_table', 'gid');
pg_get_serial_sequence
------------------------
public.t_table_gid_seq
create table t_table_1() inherits (t_table);
\d t_table_1
Table "public.t_table_1"
column | Type | Модификаторы
---------+-------------------+-------------------------------------------------------
gid | integer | not null default nextval('t_table_gid_seq'::regclass)
name | character varying |
Inherit: t_table
select pg_catalog.pg_get_serial_sequence('t_table_1', 'gid');
pg_get_serial_sequence
------------------------
<NULL>
How I can get name of sequence used by gid column of partition table? And why for t_table_1 pg_get_serial_sequence() returns NULL?
It returns NULL also if I create new sequence manually and use ALTER TABLE ALTER COLUMN <column> SET DEFAULT nextval(<my_new_sequence>::regclass).
In http://www.postgresql.org/docs/8.1/static/datatype.html#DATATYPE-SERIAL I can read that type SERIAL is equivalent to
CREATE SEQUENCE tablename_colname_seq;Thanks in advance
CREATE TABLE tablename (
colnameinteger DEFAULT nextval('tablename_colname_seq') NOT NULL
);
Sergey Karin
В списке pgsql-general по дате отправления: