Обсуждение: parser: parse error at or near... with create table
Hello all !
We wonder if any one has experience from an error (which is probably a
newbie misstake on our part) that pops up when we are trying to create a
simple table with pgAccess in a postgreSQL database. We have recieved the
same type of error on more complex table builds. The message is ...
Error executing query
create table "asdfs" ("fds" serial NOT NULL )PostgreSQL error message: Error: parser: parse error at or near
"not"
PostgreSQL status: PGRES_FATAL_ERROR
We are running ...
- PostgreSQL 6.5.1 on Red Hat Linux 6.0 ... we installed binaries downloaded
from posgresql.org and not compiled source code.
- pgAccess 0.96 on the same Red Hat Linux system as well as a Win95
computer. Win95 has tcl/tk 8.0 installed.
Thanks !
Magnus
________________________________________________________
Magnus Mengelbier
Technical Consultant
Clinical Data Care
S:t Lars v. 41
SE-222 70 LUND
SWEDEN
Phone +46 46 14 22 80
Fax +46 46 13 04 90
Email magnus.mengelbier@clinicaldatacare.com
Web http://www.clinicaldatacare.com
> We wonder if any one has experience from an error (which is probably a
> newbie misstake on our part) that pops up when we are trying to create a
> simple table with pgAccess in a postgreSQL database. We have recieved the
> same type of error on more complex table builds. The message is ...
> Error executing query
> create table "asdfs" ("fds" serial NOT NULL )
> PostgreSQL error message:
> Error: parser: parse error at or near "not"
> PostgreSQL status: PGRES_FATAL_ERROR
By definition, the SERIAL type is NOT NULL, so I didn't bother
allowing that clause in the parser. If you would like to see this
feature documented, send patches on docs/src/sgml/datatype.sgml. Or
maybe we should allow it, but it *is* redundant ;)
- Thomas
--
Thomas Lockhart lockhart@alumni.caltech.edu
South Pasadena, California
"Mengelbier, Magnus" <Magnus.Mengelbier@clinicaldatacare.com> writes:
> Error executing query
> create table "asdfs" ("fds" serial NOT NULL )
> PostgreSQL error message:
> Error: parser: parse error at or near "not"
Hmm. NOT NULL is implied by SERIAL column type, so you can just omit
that clause, but it's irritating that the parser won't accept the
explicit specification. It looks like the grammar is set up to allow
no column constraints except PRIMARY KEY after SERIAL. That seems
unnecessarily restrictive...
regards, tom lane
Thus spake Thomas Lockhart
> > create table "asdfs" ("fds" serial NOT NULL )
> By definition, the SERIAL type is NOT NULL, so I didn't bother
> allowing that clause in the parser. If you would like to see this
> feature documented, send patches on docs/src/sgml/datatype.sgml. Or
> maybe we should allow it, but it *is* redundant ;)
Given that serial is currently a hack and we plan to implement a real
serial type, we should consider what the real type will do. Is it
still going to be special? Will it act exactly as it does now? Once
we determine that then we just make the parser accept what it will
need to accept then so that people can write their queries the way
they will have to then.
I guess the main question is, will we allow the serial type to be NULL.
If not will we allow the NOT NULL phrase anyway to simplify the grammar.
If yes to either then let's allow the phrase now.
--
D'Arcy J.M. Cain <darcy@{druid|vex}.net> | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 424 2871 (DoD#0082) (eNTP) | what's for dinner.
Hi,
My quick $0.02 worth...
:
: I guess the main question is, will we allow the serial type to be NULL.
: If not will we allow the NOT NULL phrase anyway to simplify the grammar.
: If yes to either then let's allow the phrase now.
:
I don't see how you can allow a serial value to be null, since that
would defeat the purpose of a serial (presuming there were more than one
NULL-valued serial in a table). I just don't see how, logically, a serial
could allow NULLs (even if it may be desirable in some cases).
On the other hand, I would allow the NOT NULL phrase, even though
it's redundant.
Brendan
--
Brendan McKenna
Technical Director Phone: +353-(0)61-338177 x4143
W3 Services Ltd. Fax: +353-(0)61-338065
Innovation Centre Email: brendan@w3s.ie
National Technological Park
Limerick
Ireland