Thread: Field add error

Field add error

From
"Jozsef Aron"
Date:
Hello Everybody!

Sorry, my English is very peer.

This is Database:

CREATE DATABASE TVGAR
WITH ENCODING='LATIN1'
OWNER=tvgaruser
TEMPLATE=template0
TABLESPACE=pg_default;
GRANT ALL ON DATABASE TVGAR TO GROUP "TVGAR";

This is Shema:

CREATE SCHEMA 'X' AUTHORIZATION postgres;
GRANT ALL ON SCHEMA 'X' TO postgres;
GRANT ALL ON SCHEMA 'X' TO public;
COMMENT ON SCHEMA 'X' IS 'abc';

X shema's table:

CREATE TABLE X.tabla (
razon bigserial,
2e00 varchar(11),
AS varchar(5)
...
..
.
PRIMARY KEY (razon)
) WITHOUT OIDS;

Fields name is not ok., denied : 'AS','1e00','2e00'

ERROR: Syntax error at to near "2e00" at character 1443

What is problem?

This support, very well thanks!

Áron József, Hungary

Re: Field add error

From
Richard Huxton
Date:
Jozsef Aron wrote:
>
> CREATE TABLE X.tabla (
> razon bigserial,
> 2e00 varchar(11),
> AS varchar(5)
> ...
> ..
> .
> PRIMARY KEY (razon)
> ) WITHOUT OIDS;
>
> Fields name is not ok., denied : 'AS','1e00','2e00'

I believe this is normal as regards identifier names. The word "AS" is
probably reserved (sorry, haven't checked) and I don't think you can
start an identifier with a number.

So - if you want to use these names you must quote them:
   CREATE TABLE zzz1 ("2e00" int4);

If you would like to discuss this further, subscribe to the
pgsql-general mailing list where there are lots of people who can help you.

--
   Richard Huxton
   Archonet Ltd