Thread
-
very odd behavior
newsreader@mediaone.net — 2001-05-10T18:08:56Z
I have 7.1 Can someone take a look the following and tell me why I'm getting errors? I'm completely baffled! ---------------------------- what=> create table bla(desc text,def text,data text); ERROR: parser: parse error at or near "desc" what=> create table bla("desc" text,def text,data text); CREATE what=> -
Re: very odd behavior
Mitch Vincent <mitch@venux.net> — 2001-05-10T18:21:13Z
desc is a reserved keyword (used in ORDER BY to indicate descending order).. You can use keywords as field names though you have to put the in quotes (as you found out!). -Mitch ----- Original Message ----- From: <newsreader@mediaone.net> To: <pgsql-general@postgresql.org> Sent: Thursday, May 10, 2001 2:08 PM Subject: very odd behavior > I have 7.1 > > Can someone take a look the following > and tell me why I'm getting errors? > I'm completely baffled! > ---------------------------- > > what=> create table bla(desc text,def text,data text); > ERROR: parser: parse error at or near "desc" > what=> create table bla("desc" text,def text,data text); > CREATE > what=> > > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) > -
Re: very odd behavior
Jeff Daugherty <jdaugherty@greatbridge.com> — 2001-05-10T18:51:34Z
desc is a reserved word (descending, ascending, having, from, etc...), as in: select * from foo order by col_a desc; That is why you need the double quotes. jeff Jeff Daugherty Database Systems Engineer Great Bridge LLC newsreader@mediaone.net wrote: > I have 7.1 > > Can someone take a look the following > and tell me why I'm getting errors? > I'm completely baffled! > ---------------------------- > > what=> create table bla(desc text,def text,data text); > ERROR: parser: parse error at or near "desc" > what=> create table bla("desc" text,def text,data text); > CREATE > what=> > > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) -
Re: very odd behavior
Patrick Welche <prlw1@newn.cam.ac.uk> — 2001-05-10T18:51:46Z
On Thu, May 10, 2001 at 02:08:56PM -0400, newsreader@mediaone.net wrote: > I have 7.1 > > Can someone take a look the following > and tell me why I'm getting errors? > I'm completely baffled! > ---------------------------- > > what=> create table bla(desc text,def text,data text); > ERROR: parser: parse error at or near "desc" > what=> create table bla("desc" text,def text,data text); > CREATE > what=> desc is used to mean descending, as in "order by foo desc". If you enclose that keyword in quotes, then the parser knows you are using it as a field name and doesn't wonder about what should be descending.. Cheers, Patrick