Oddity in column specifications for table creation

Поиск
Список
Период
Сортировка
От Marc Munro
Тема Oddity in column specifications for table creation
Дата
Msg-id 1197402045.27581.12.camel@bloodnok.com
обсуждение исходный текст
Ответы Re: Oddity in column specifications for table creation  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
It seems that in create table I cannot specify the schema of a built-in
type that has a length specifier.  Nor can I double-quote the type name.
Is this correct/expected behaviour, and are there work-arounds?

This works fine:

create table "public"."additional" (
  "str1"                "pg_catalog"."text" not null,
  "str2"                "pg_catalog"."varchar"
  );

This does not:

  create table "public"."additional" (
    "str1"                "pg_catalog"."text" not null,
    "str2"                "pg_catalog"."varchar"(40)
    );
  ERROR:  syntax error at or near "("
  LINE 3:   "str2"                "pg_catalog"."varchar"(40)

Or this:

  create table "public"."additional" (
    "str1"                "pg_catalog"."text" not null,
    "str2"                "pg_catalog".varchar(40)
    );
  ERROR:  syntax error at or near "("
  LINE 3:   "str2"                "pg_catalog".varchar(40)

Or this:

create table "public"."additional" (
  "str1"                "pg_catalog"."text" not null,
  "str2"                pg_catalog.varchar(40)
  );
ERROR:  syntax error at or near "("
LINE 3:   "str2"                pg_catalog.varchar(40)

But this does:

  create table "public"."additional" (
    "str1"                "pg_catalog"."text" not null,
    "str2"                varchar(40)
  );

For now, I will simply not quote or schema-specify anything from
pg_catalog (though I guess I should force the search path to only
include pg_catalog in this case) but I find the limitation kinda odd.

This is in 8.1 and 8.2

__
Marc

Вложения

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

Предыдущее
От: "John D. Burger"
Дата:
Сообщение: Re: top posting
Следующее
От: Thomas Hart
Дата:
Сообщение: Re: top posting