Oddity in column specifications for table creation

From: Marc Munro <marc(at)bloodnok(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Oddity in column specifications for table creation
Date: 2007-12-11 19:40:45
Message-ID: 1197402045.27581.12.camel@bloodnok.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Gregory Stark 2007-12-11 19:44:31 Re: top posting
Previous Message Thomas Hart 2007-12-11 19:40:06 Re: top posting