Thread: [GENERAL] Why is table not found?
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I created a db 'Hausrat' with a table "Raum". If I look in pgadmin I find the the table. In sql field is shown: > -- Table: "Raum" > > -- DROP TABLE "Raum"; > > CREATE TABLE "Raum" > ( > "RaumID" serial NOT NULL, -- Automatisch vergebenes Identifizierungsmerkmal für den Raum > "Raum" character varying(15), -- Bezeichnung des Raums > CONSTRAINT "Raum_pkey" PRIMARY KEY ("RaumID") > ) > WITH ( > OIDS=FALSE > ); > ALTER TABLE "Raum" > OWNER TO egon; > COMMENT ON COLUMN "Raum"."RaumID" IS 'Automatisch vergebenes Identifizierungsmerkmal für den Raum'; > COMMENT ON COLUMN "Raum"."Raum" IS 'Bezeichnung des Raums'; > > > -- Index: "Raum_RaumID_idx" > > -- DROP INDEX "Raum_RaumID_idx"; > > CREATE INDEX "Raum_RaumID_idx" > ON "Raum" > USING btree > ("RaumID"); > But psql tells me "Raum" is not existent: > egon@xfEinzel ~ $ psql Hausrat > psql (9.3.15) > Type "help" for help. > > Hausrat=# SELECT * FROM Raum; > ERROR: relation "raum" does not exist > LINE 1: SELECT * FROM Raum; > ^ > Hausrat=# Why? Egon -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIbBAEBAgAGBQJYkJTwAAoJECc7nbY+bg5uiRQP9iC4UtbHpPvdvV796fxcMSFp dncPHzkTKHvcEh3V9t/Xn/BzEHBDAO6RO8jmU18Ja9f/0nOyNXrWxal0OJZXint5 l3/qRKbekkl7zfogysh4XgZQkpWwsJcYDGoG5tCUQm8TJ3sCk9a9+mbkDhy0Vsev MPeyYl/fYvlTBkiRmlPZTOX7YjRzeryKXguB3PBke3Vo6SZ1GGGGsFWnMjJ7bc2b 4cW9hmInmwXZ4EBOfcUW4QnfM0mgHBMGxJwYVQfeC6fQeqT8emh0KQLqozjFe/tk KNKDU0RebcrBgXP/lIGI34XahZW+WOdLli/t8wBUNiINruY2FlizuH6Uuak3tLjC cD7vi0SzNK2YFr9Rozw8ow9WVxSfjWBLiOA1GkFdhxKb80NLHthzo8oIVaCqz0bj 71kA0ewgZ9NMay6ch1VjqSPPFhAZHc1Ho3xIAa0BsZpvEdccDBsL+yk/6DGDYua9 5oT1p6CZqfDJqxEIoUiNaJEKm3An5ySN8hHn527/apG9yA9QMh5qJPHA0wRqtLxN hNSxugKhS6UOw/Wivbx0OIhN8jqBv4m22UgO9pFGgxHLs1hheSTMUSbExFCLuK+z sS1Kw9syplk+lFTzK6mqNpr3BQ6v2fmkPmRTZoID4e9T3DY8Bna2JXG2U1QGEzwa kwpJOMAvY3DDPv3pIK8= =i8FY -----END PGP SIGNATURE-----
On 31/01/17 13:45, Egon Frerich wrote: > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > I created a db 'Hausrat' with a table "Raum". If I look in pgadmin I > find the the table. In sql field is shown: > >> -- Table: "Raum" >> >> -- DROP TABLE "Raum"; >> >> CREATE TABLE "Raum" >> ( >> "RaumID" serial NOT NULL, -- Automatisch vergebenes > Identifizierungsmerkmal für den Raum >> "Raum" character varying(15), -- Bezeichnung des Raums >> CONSTRAINT "Raum_pkey" PRIMARY KEY ("RaumID") >> ) >> WITH ( >> OIDS=FALSE >> ); >> ALTER TABLE "Raum" >> OWNER TO egon; >> COMMENT ON COLUMN "Raum"."RaumID" IS 'Automatisch vergebenes > Identifizierungsmerkmal für den Raum'; >> COMMENT ON COLUMN "Raum"."Raum" IS 'Bezeichnung des Raums'; >> >> >> -- Index: "Raum_RaumID_idx" >> >> -- DROP INDEX "Raum_RaumID_idx"; >> >> CREATE INDEX "Raum_RaumID_idx" >> ON "Raum" >> USING btree >> ("RaumID"); >> > But psql tells me "Raum" is not existent: > >> egon@xfEinzel ~ $ psql Hausrat >> psql (9.3.15) >> Type "help" for help. >> >> Hausrat=# SELECT * FROM Raum; >> ERROR: relation "raum" does not exist >> LINE 1: SELECT * FROM Raum; Object names are folded to lower-case automatically, unless you enclose them in double-quotes: select * from "Raum"; Ray. -- Raymond O'Donnell :: Galway :: Ireland rod@iol.ie
Hello Egon, You created the table using delimited identifiers: "Raum" which is not the same as Raum of raum or RAUM When you use delimited identifiers (eg: "MyTable" instead of MyTable), the name becomes case sensitive. When you use SQL, you need to use delimited identifiers: select * from "Raum" With regards, Martijn Tonies Upscene Productions http://www.upscene.com Database Workbench - developer tool for Oracle, MS SQL Server, PostgreSQL, SQL Anywhere, MySQL, InterBase, NexusDB and Firebird. -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I created a db 'Hausrat' with a table "Raum". If I look in pgadmin I find the the table. In sql field is shown: > -- Table: "Raum" > > -- DROP TABLE "Raum"; > > CREATE TABLE "Raum" > ( > "RaumID" serial NOT NULL, -- Automatisch vergebenes Identifizierungsmerkmal für den Raum > "Raum" character varying(15), -- Bezeichnung des Raums > CONSTRAINT "Raum_pkey" PRIMARY KEY ("RaumID") > ) > WITH ( > OIDS=FALSE > ); > ALTER TABLE "Raum" > OWNER TO egon; > COMMENT ON COLUMN "Raum"."RaumID" IS 'Automatisch vergebenes Identifizierungsmerkmal für den Raum'; > COMMENT ON COLUMN "Raum"."Raum" IS 'Bezeichnung des Raums'; > > > -- Index: "Raum_RaumID_idx" > > -- DROP INDEX "Raum_RaumID_idx"; > > CREATE INDEX "Raum_RaumID_idx" > ON "Raum" > USING btree > ("RaumID"); > But psql tells me "Raum" is not existent: > egon@xfEinzel ~ $ psql Hausrat > psql (9.3.15) > Type "help" for help. > > Hausrat=# SELECT * FROM Raum; > ERROR: relation "raum" does not exist > LINE 1: SELECT * FROM Raum; > ^ > Hausrat=# Why? Egon -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIbBAEBAgAGBQJYkJTwAAoJECc7nbY+bg5uiRQP9iC4UtbHpPvdvV796fxcMSFp dncPHzkTKHvcEh3V9t/Xn/BzEHBDAO6RO8jmU18Ja9f/0nOyNXrWxal0OJZXint5 l3/qRKbekkl7zfogysh4XgZQkpWwsJcYDGoG5tCUQm8TJ3sCk9a9+mbkDhy0Vsev MPeyYl/fYvlTBkiRmlPZTOX7YjRzeryKXguB3PBke3Vo6SZ1GGGGsFWnMjJ7bc2b 4cW9hmInmwXZ4EBOfcUW4QnfM0mgHBMGxJwYVQfeC6fQeqT8emh0KQLqozjFe/tk KNKDU0RebcrBgXP/lIGI34XahZW+WOdLli/t8wBUNiINruY2FlizuH6Uuak3tLjC cD7vi0SzNK2YFr9Rozw8ow9WVxSfjWBLiOA1GkFdhxKb80NLHthzo8oIVaCqz0bj 71kA0ewgZ9NMay6ch1VjqSPPFhAZHc1Ho3xIAa0BsZpvEdccDBsL+yk/6DGDYua9 5oT1p6CZqfDJqxEIoUiNaJEKm3An5ySN8hHn527/apG9yA9QMh5qJPHA0wRqtLxN hNSxugKhS6UOw/Wivbx0OIhN8jqBv4m22UgO9pFGgxHLs1hheSTMUSbExFCLuK+z sS1Kw9syplk+lFTzK6mqNpr3BQ6v2fmkPmRTZoID4e9T3DY8Bna2JXG2U1QGEzwa kwpJOMAvY3DDPv3pIK8= =i8FY -----END PGP SIGNATURE----- -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
You must quite as "Raum" > On Jan 31, 2017, at 6:45 AM, Egon Frerich <egon@frerich.eu> wrote: > > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > I created a db 'Hausrat' with a table "Raum". If I look in pgadmin I > find the the table. In sql field is shown: > >> -- Table: "Raum" >> >> -- DROP TABLE "Raum"; >> >> CREATE TABLE "Raum" >> ( >> "RaumID" serial NOT NULL, -- Automatisch vergebenes > Identifizierungsmerkmal für den Raum >> "Raum" character varying(15), -- Bezeichnung des Raums >> CONSTRAINT "Raum_pkey" PRIMARY KEY ("RaumID") >> ) >> WITH ( >> OIDS=FALSE >> ); >> ALTER TABLE "Raum" >> OWNER TO egon; >> COMMENT ON COLUMN "Raum"."RaumID" IS 'Automatisch vergebenes > Identifizierungsmerkmal für den Raum'; >> COMMENT ON COLUMN "Raum"."Raum" IS 'Bezeichnung des Raums'; >> >> >> -- Index: "Raum_RaumID_idx" >> >> -- DROP INDEX "Raum_RaumID_idx"; >> >> CREATE INDEX "Raum_RaumID_idx" >> ON "Raum" >> USING btree >> ("RaumID"); >> > But psql tells me "Raum" is not existent: > >> egon@xfEinzel ~ $ psql Hausrat >> psql (9.3.15) >> Type "help" for help. >> >> Hausrat=# SELECT * FROM Raum; >> ERROR: relation "raum" does not exist >> LINE 1: SELECT * FROM Raum; >> ^ >> Hausrat=# > > Why? > > Egon > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v2.0.22 (GNU/Linux) > > iQIbBAEBAgAGBQJYkJTwAAoJECc7nbY+bg5uiRQP9iC4UtbHpPvdvV796fxcMSFp > dncPHzkTKHvcEh3V9t/Xn/BzEHBDAO6RO8jmU18Ja9f/0nOyNXrWxal0OJZXint5 > l3/qRKbekkl7zfogysh4XgZQkpWwsJcYDGoG5tCUQm8TJ3sCk9a9+mbkDhy0Vsev > MPeyYl/fYvlTBkiRmlPZTOX7YjRzeryKXguB3PBke3Vo6SZ1GGGGsFWnMjJ7bc2b > 4cW9hmInmwXZ4EBOfcUW4QnfM0mgHBMGxJwYVQfeC6fQeqT8emh0KQLqozjFe/tk > KNKDU0RebcrBgXP/lIGI34XahZW+WOdLli/t8wBUNiINruY2FlizuH6Uuak3tLjC > cD7vi0SzNK2YFr9Rozw8ow9WVxSfjWBLiOA1GkFdhxKb80NLHthzo8oIVaCqz0bj > 71kA0ewgZ9NMay6ch1VjqSPPFhAZHc1Ho3xIAa0BsZpvEdccDBsL+yk/6DGDYua9 > 5oT1p6CZqfDJqxEIoUiNaJEKm3An5ySN8hHn527/apG9yA9QMh5qJPHA0wRqtLxN > hNSxugKhS6UOw/Wivbx0OIhN8jqBv4m22UgO9pFGgxHLs1hheSTMUSbExFCLuK+z > sS1Kw9syplk+lFTzK6mqNpr3BQ6v2fmkPmRTZoID4e9T3DY8Bna2JXG2U1QGEzwa > kwpJOMAvY3DDPv3pIK8= > =i8FY > -----END PGP SIGNATURE----- > > > > > -- > Sent via pgsql-general mailing list (pgsql-general@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-general
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I created a db 'Hausrat' with a table "Raum". If I look in pgadmin I
find the the table. In sql field is shown:
> -- Table: "Raum"
>
> -- DROP TABLE "Raum";
>
> CREATE TABLE "Raum"
> (
> "RaumID" serial NOT NULL, -- Automatisch vergebenes
Identifizierungsmerkmal für den Raum
> "Raum" character varying(15), -- Bezeichnung des Raums
> CONSTRAINT "Raum_pkey" PRIMARY KEY ("RaumID")
> )
> WITH (
> OIDS=FALSE
> );
> ALTER TABLE "Raum"
> OWNER TO egon;
> COMMENT ON COLUMN "Raum"."RaumID" IS 'Automatisch vergebenes
Identifizierungsmerkmal für den Raum';
> COMMENT ON COLUMN "Raum"."Raum" IS 'Bezeichnung des Raums';
>
>
> -- Index: "Raum_RaumID_idx"
>
> -- DROP INDEX "Raum_RaumID_idx";
>
> CREATE INDEX "Raum_RaumID_idx"
> ON "Raum"
> USING btree
> ("RaumID");
>
But psql tells me "Raum" is not existent:
> egon@xfEinzel ~ $ psql Hausrat
> psql (9.3.15)
> Type "help" for help.
>
> Hausrat=# SELECT * FROM Raum;
> ERROR: relation "raum" does not exist
> LINE 1: SELECT * FROM Raum;
> ^
> Hausrat=#
Why?
Because, "Raum" is not equal to Raum. This is because, when a name is not enclosed in " marks, PostgreSQL will force it to be lower case. So "Raum" is mixed cased, as you would expect. But Raum is basically converted to "raum".
Egon
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
iQIbBAEBAgAGBQJYkJTwAAoJECc7nbY+ bg5uiRQP9iC4UtbHpPvdvV796fxcMS Fp
dncPHzkTKHvcEh3V9t/Xn/BzEHBDAO6RO8jmU18Ja9f/ 0nOyNXrWxal0OJZXint5
l3/qRKbekkl7zfogysh4XgZQkpWwsJcYD GoG5tCUQm8TJ3sCk9a9+ mbkDhy0Vsev
MPeyYl/fYvlTBkiRmlPZTOX7YjRzeryKXguB3 PBke3Vo6SZ1GGGGsFWnMjJ7bc2b
4cW9hmInmwXZ4EBOfcUW4QnfM0mgHBMGxJwYVQfeC6fQeqT8emh0KQLqozjF e/tk
KNKDU0RebcrBgXP/lIGI34XahZW+WOdLli/ t8wBUNiINruY2FlizuH6Uuak3tLjC
cD7vi0SzNK2YFr9Rozw8ow9WVxSfjWBLiOA1GkFdhxKb80NLHthzo8oIVaCq z0bj
71kA0ewgZ9NMay6ch1VjqSPPFhAZHc1Ho3xIAa0BsZpvEdccDBsL+yk/ 6DGDYua9
5oT1p6CZqfDJqxEIoUiNaJEKm3An5ySN8hHn527/ apG9yA9QMh5qJPHA0wRqtLxN
hNSxugKhS6UOw/Wivbx0OIhN8jqBv4m22UgO9pFGgxHL s1hheSTMUSbExFCLuK+z
sS1Kw9syplk+lFTzK6mqNpr3BQ6v2fmkPmRTZoID4e 9T3DY8Bna2JXG2U1QGEzwa
kwpJOMAvY3DDPv3pIK8=
=i8FY
-----END PGP SIGNATURE-----
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
There’s no obfuscated Perl contest because it’s pointless.
—Jeff Polk
—Jeff Polk
Maranatha! <><
John McKown
John McKown
> On 31 Jan 2017, at 14:45, Egon Frerich <egon@frerich.eu> wrote: >> >> CREATE TABLE "Raum" >> ( >> "RaumID" serial NOT NULL, -- Automatisch vergebenes > But psql tells me "Raum" is not existent: > >> egon@xfEinzel ~ $ psql Hausrat >> psql (9.3.15) >> Type "help" for help. >> >> Hausrat=# SELECT * FROM Raum; >> ERROR: relation "raum" does not exist >> LINE 1: SELECT * FROM Raum; Instead of adding quotes to your select statement (as others suggested), IMHO the better thing to do is to remove them fromyour create statements. Most of the time there is no benefit creating case-sensitive identifiers in a database. Alban Hertroys -- If you can't see the forest for the trees, cut the trees and you'll find there is no forest.
Thank you all for your answers. You see: it is a newbie question. Egon Am 31.01.2017 um 14:45 schrieb Egon Frerich: > > I created a db 'Hausrat' with a table "Raum". If I look in pgadmin I > find the the table. In sql field is shown: > > > -- Table: "Raum" > > > -- DROP TABLE "Raum"; > > > CREATE TABLE "Raum" > > ( > > "RaumID" serial NOT NULL, -- Automatisch vergebenes > Identifizierungsmerkmal für den Raum > > "Raum" character varying(15), -- Bezeichnung des Raums > > CONSTRAINT "Raum_pkey" PRIMARY KEY ("RaumID") > > ) > > WITH ( > > OIDS=FALSE > > ); > > ALTER TABLE "Raum" > > OWNER TO egon; > > COMMENT ON COLUMN "Raum"."RaumID" IS 'Automatisch vergebenes > Identifizierungsmerkmal für den Raum'; > > COMMENT ON COLUMN "Raum"."Raum" IS 'Bezeichnung des Raums'; > > > > -- Index: "Raum_RaumID_idx" > > > -- DROP INDEX "Raum_RaumID_idx"; > > > CREATE INDEX "Raum_RaumID_idx" > > ON "Raum" > > USING btree > > ("RaumID"); > > But psql tells me "Raum" is not existent: > > > egon@xfEinzel ~ $ psql Hausrat > > psql (9.3.15) > > Type "help" for help. > > > Hausrat=# SELECT * FROM Raum; > > ERROR: relation "raum" does not exist > > LINE 1: SELECT * FROM Raum; > > ^ > > Hausrat=# > > Why? > > Egon > > > > >