Re: Probably a stupid question - Mailing list pgsql-novice

From greg@turnstep.com
Subject Re: Probably a stupid question
Date
Msg-id b52f39381a51aea3cc3eb292aaa2678b@biglumber.com
Whole thread Raw
In response to Probably a stupid question  ("Giorgio Ponza" <giorgio@opla.it>)
Responses Re: Probably a stupid question  (Dani Oderbolz <oderbolz@ecologic.de>)
List pgsql-novice
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1




> CREATE TABLE "MirrorHosts" ..... etc etc
>
> 1) the command \d MirrorHosts doesn't work (table MirrorHost not found),
>    i have to use \d "MirrorHosts"
> 2) when i do SELECT * FROM MirrorHosts;   (the same prob)
>    i have to use "MirrorHosts"
>
> I'd like to know if there is a way to bypass this problem.
> Tx in advance and ..... PostgreSQL is really GREAT!

When you created the table using the quotes, it forced the name to use
mixed-case. Therefore, you must use the exact same case afterwards.
The simple way to get around this is to not use quotes around the
tablename, or simply lowercase the name in your initial create:

CREATE TABLE MirrorHosts ...

or

CREATE TABLE "mirrorhosts"...


If you have already created the "MirrorHosts" table and do not want to
lose the data inside it, you could do this:

CREATE TABLE mirrorhosts AS SELECT * FROM mirrorhosts;

DROP TABLE mirrorhosts;

(this assumes the table is simple and has no foreign keys, triggers, etc.)


- --
Greg Sabino Mullane greg@turnstep.com
PGP Key: 0x14964AC8 200306270912

-----BEGIN PGP SIGNATURE-----
Comment: http://www.turnstep.com/pgp.html

iD8DBQE+/ERSvJuQZxSWSsgRAqSRAJ9Te5Nln3IQGoXSA/OAoT+z7sLw/ACfXjXu
ZbXB5apFwC0OiOJrFomR57g=
=noEp
-----END PGP SIGNATURE-----



pgsql-novice by date:

Previous
From: Nabil Sayegh
Date:
Subject: Re: Address Table
Next
From: greg@turnstep.com
Date:
Subject: Re: missing postmaster.conf