Обсуждение: sequences in schemas

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

sequences in schemas

От
Joe Maldonado
Дата:
Hello,
How come within a create schema block I cannot create a sequence?
I have entered in:

CREATE SCHEMA joe
    CREATE SEQUENCE joe_seq start 1
    CREATE TABLE joe_table (int id, varchar name)
;

and I get a syntax error for SEQUENCE. though if it is just tables I do not

-Joe

Re: sequences in schemas

От
Pierre-Frédéric Caillaud
Дата:
    You forgot the ";"

  CREATE SCHEMA joe;
  CREATE SEQUENCE joe.joe_seq start 1;
  CREATE TABLE joe.joe_table (int id, varchar name);


Re: sequences in schemas

От
Manfred Koizar
Дата:
On Tue, 31 Aug 2004 11:09:07 -0400, Joe Maldonado
<jmaldonado@webehosting.biz> wrote:
>CREATE SCHEMA joe
>    CREATE SEQUENCE joe_seq start 1
>    CREATE TABLE joe_table (int id, varchar name)
>;
>
>and I get a syntax error for SEQUENCE.

This will work in 8.0.

http://www.postgresql.org/docs/7.4/static/sql-createschema.html:
schema_element
    An SQL statement defining an object to be created within the schema.
Currently, only CREATE TABLE, CREATE VIEW, and GRANT are accepted as
clauses within CREATE SCHEMA.

http://developer.postgresql.org/docs/postgres/sql-createschema.html:
schema_element
    An SQL statement defining an object to be created within the schema.
Currently, only CREATE TABLE, CREATE VIEW, CREATE INDEX, CREATE
SEQUENCE, CREATE TRIGGER and GRANT are accepted as clauses within CREATE
SCHEMA.

In the meantime "Other kinds of objects may be created in separate
commands after the schema is created."

Servus
 Manfred