create table within a schema

Поиск
Список
Период
Сортировка
От Vincent De Groote
Тема create table within a schema
Дата
Msg-id 1304680244.4709.36.camel@portable-vdg
обсуждение исходный текст
Ответы Re: create table within a schema
Список pgsql-general
Hello

I have the following code:

create schema test;

create type test.my_type as enum ( 'a', 'b' );

create table test.my_table_1 (
    id     bigserial not null,
    type   test.my_type not null,
    length bigint,
    primary key ( id )
);


create sequence test.my_sequence_id;


create table test.my_table_2 (
id     bigint not null default public.nextval ( test.my_sequence_id ),
type   test.my_type not null,
length bigint,
primary key ( id )
);

This last create operation fails with the message

ERROR:  missing FROM-clause entry for table "test"

Could someone explain me that error ?  What are the difference between the table my_table_1 and the table my_table_2  ?
The documentation show that the table creation must be followed by a statement like
ALTER SEQUENCE tablename_colname_seq OWNED BY tablename.colname;
but the table creation has been rejected.

Thanks for your reply

Vincent De Groote





В списке pgsql-general по дате отправления:

Предыдущее
От: "Asfand Qazi (Sanger Institute)"
Дата:
Сообщение: Re: Generating fields in views with search/replace?
Следующее
От: Simon Riggs
Дата:
Сообщение: Re: create table within a schema