От:
juerg.rietmann@pup.ch
Дата:
I have a question regarding a strange behaviour. I use postgreSQL 7.0.3 on SuSE Linux, Coldfusion 4.5.2 SP2 and the pgAdmin 7.0.4. For development I use Ultradev 4.0. I created a database with createdb customer with a table order. The query select * from order dosn't work. Doing select * from "order" is ok. When i do a query on as system table the quotes are not needed. Since Ultradev builds queries without the quotes, I can't use the queries with the quotes. Why do I need the quotes on my new defined table ? Is Encoding the point ? Thanks in advance ... jr ============================================ PFISTER + PARTNER, SYSTEM - ENGINEERING AG Juerg Rietmann Grundstrasse 22a 6343 Rotkreuz Switzerland phone: +4141 790 4040 fax: +4141 790 2545 mobile: +4179 211 0315 ============================================
Re:
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
juerg.rietmann@pup.ch writes: > The query select * from order dosn't work. Doing select * from "order" is > ok. ORDER is a reserved word in SQL (think ORDER BY). regards, tom lane
RE:
От:
"Tamsin" <tg_mail@bryncadfan.co.uk>
Дата:
i would guess that order is a reserved word, as its used in queries like select * from customers order by customerid so its probably best not to use it as a tablename. HTH tamsin > -----Original Message----- > From: pgsql-novice-owner@postgresql.org > [mailto:pgsql-novice-owner@postgresql.org]On Behalf Of > juerg.rietmann@pup.ch > Sent: 14 December 2000 15:30 > To: pgsql-novice@postgresql.org > Subject: [NOVICE] > > > I have a question regarding a strange behaviour. > > I use postgreSQL 7.0.3 on SuSE Linux, Coldfusion 4.5.2 SP2 and the pgAdmin > 7.0.4. For development I use Ultradev 4.0. > > I created a database with > > createdb customer with a table order. > > The query select * from order dosn't work. Doing select * from "order" is > ok. When i do a query on as system table the quotes are not needed. Since > Ultradev builds queries without the quotes, I can't use the queries with > the quotes. > > Why do I need the quotes on my new defined table ? Is Encoding the point ? > > Thanks in advance ... jr > > ============================================ > PFISTER + PARTNER, SYSTEM - ENGINEERING AG > Juerg Rietmann > Grundstrasse 22a > 6343 Rotkreuz > Switzerland > > phone: +4141 790 4040 > fax: +4141 790 2545 > mobile: +4179 211 0315 > ============================================ > >
Re:
От:
John Burski <John.Burski@911ep.com>
Дата:
Just a short note on developing a coding "style".
While "order" is a reserved word in PostgreSQL, that doesn't mean that you
can't use the word for a table name, or, more precisely, part of a table name.
As an example, consider the following:
CREATE TABLE order_tbl ...
The example embeds the word "order" into the the actual name of the table
"order_tbl". This accomplishes a couple of things. First, your table name is
intuitive - it's a table that contains orders. Second, somewhere down the road
someone, maybe you, may be attempting to modify your code - since you've used
an intuitive "style" it will be easier to read and understand later.
I ran into a similar problem with column name in a table I named
"employee_tbl". As it happens, "position" is a PostgreSQL reserved word, too.
I finally chose "job_description" as the column name.
Tamsin wrote:
> i would guess that order is a reserved word, as its used in queries like
> select * from customers order by customerid
> so its probably best not to use it as a tablename.
> HTH
> tamsin
>
> > -----Original Message-----
> > From: pgsql-novice-owner@postgresql.org
> > [mailto:pgsql-novice-owner@postgresql.org]On Behalf Of
> > juerg.rietmann@pup.ch
> > Sent: 14 December 2000 15:30
> > To: pgsql-novice@postgresql.org
> > Subject: [NOVICE]
> >
> >
> > I have a question regarding a strange behaviour.
> >
> > I use postgreSQL 7.0.3 on SuSE Linux, Coldfusion 4.5.2 SP2 and the pgAdmin
> > 7.0.4. For development I use Ultradev 4.0.
> >
> > I created a database with
> >
> > createdb customer with a table order.
> >
> > The query select * from order dosn't work. Doing select * from "order" is
> > ok. When i do a query on as system table the quotes are not needed. Since
> > Ultradev builds queries without the quotes, I can't use the queries with
> > the quotes.
> >
> > Why do I need the quotes on my new defined table ? Is Encoding the point ?
> >
> > Thanks in advance ... jr
> >
> > ============================================
> > PFISTER + PARTNER, SYSTEM - ENGINEERING AG
> > Juerg Rietmann
> > Grundstrasse 22a
> > 6343 Rotkreuz
> > Switzerland
> >
> > phone: +4141 790 4040
> > fax: +4141 790 2545
> > mobile: +4179 211 0315
> > ============================================
> >
> >
--
John Burski
Chief IT Cook and Bottlewasher
911 Emergency Products, St. Cloud, MN
(320) 656 0076
++++++++++++++++++++++++++++++++++
+ How's your cheese holding out? +
++++++++++++++++++++++++++++++++++