Re: Autonumbering Problem? - Mailing list pgsql-novice

From Andreas
Subject Re: Autonumbering Problem?
Date
Msg-id 44E9F869.6040506@gmx.net
Whole thread Raw
In response to Autonumbering Problem?  (Arthur Baldwin <mobilepc@mobilepcclinic.net>)
List pgsql-novice

Arthur Baldwin schrieb:
> tco=# insert into customers (FullName) values ('Arthur E. Baldwin');
> ERROR:  relation "customers" does not exist
> tco=# \d
>                  List of relations
>  Schema |         Name         |   Type   | Owner
> --------+----------------------+----------+--------
>  public | Customers            | table    | arthur
>  public | Customers_CustID_seq | sequence | arthur
> (2 rows)
>
> What am I doing wrong?
>
Postgresql's handles identifiers case relevant, as the other posters
allready mentioned.
So you created Customers with "C" and wanted to insert into customers
with "c".
The same goes for column names, too.
You can either use double quotes " for all identifiers or stop using
upper case characters in names. Actually I'm not even sure if PG
converts unquoted identifiers to lower or rather to upper case internally.
This behaviour seems to be stupid but AFAIK it conforms to SQL rules and
it is cleaner because you get what you asked for and not what the DBMS
thinks you probaply wanted to ask for but didn't.

I guess you used some GUI tool to create the tables. PGAdmin for example
uses the quotes automatically if you try to create tables/columns with
mixed case names.
That could lead to ambiguities since you are even alowed to have a table
"Customers" besides another one called "customers".

And while we are at it ... PG distinguishes upper/lower case in string
comparisons, too.
You should be aware that MySQL and Access will find 'Arthur', 'arthur',
'ArtHur' if you use SELECT ... WHERE name= 'arthur'.
Postgresql only shows 1 record that matches the criterium exacly.







pgsql-novice by date:

Previous
From: Andreas
Date:
Subject: invalid byte sequence ?
Next
From: Saranya Sivakumar
Date:
Subject: Incremental backup with Postgres 7.3.2