Helpful Information
 
 
Category: PostgreSQL Help
Relation ... does not exist

Hi everyone.

I've a problem using PostgreSQL (7.0.2) and PHP (4.0.3pl1).

At first I created a database at the console. No problems!
Then I created the table (tTexte) in this database via phpPgAdmin (2.1). No problems!
I've inserted some data, and again no problems!

But when I try to make a SELECT on the table (via phpPgAdmin, via console or via php script) I always get the error: Relation "tTexte" does not exist".

I think it's a PostgreSQL Problem, so I posted it in this forum.
I've searched some FAQs but I am still clueless. Please, is there anybody out there who can help...

TIA
Regards Martin

Hi, me again.

After a weekend of trial and error, I've found out that using quotes or tablename in lowercase will work.

Still don't know why, but who cares http://www.devshed.com/Talk/Forums/smile.gif

Martin

i wish someone could expand on this. i am experiencing this problem right now. i can create tables in PostGRES when my application bootstraps but when i try to add data then i get this "relation does not exist" error.

my first guess is that this means that the table is rejecting an insert because it has no primary key, but this isn't true. im creating a key.

can anyone explain this error? im running version 7.5devel

i wish someone could expand on this. i am experiencing this problem right now. i can create tables in PostGRES when my application bootstraps but when i try to add data then i get this "relation does not exist" error.

my first guess is that this means that the table is rejecting an insert because it has no primary key, but this isn't true. im creating a key.

can anyone explain this error? im running version 7.5devel

Relation does not exist usually means that you're not referencing the table correctly. It looks like the original poster just recently learned that PostgreSQL defaults table name to lowercase in queries unless escaped with quotes. What this means is that if you created a table with table name MyTable then trying to do:
SELECT * FROM MyTable
will give an error however
SELECT * FROM "MyTable"
will not.
So the moral is either use quotes for table names if you want to have mixed case names, or always use lowercase.

Hopefully this answers your question.

-b

select * from "NAMES" does work thankfully (where all tables and columns are uppercased), and so i am not completely lost.

here is my dilemma now:

this works:
UPDATE "uservalue" SET i_uval_usra_id=4;

but this does not:
UPDATE "uservalue" SET uservalue.i_uval_usra_id=4;
it gets this error:
ODBC Error:ERROR: column "uservalue" of relation "uservalue" does not exist

select * from "NAMES" does work thankfully (where all tables and columns are uppercased), and so i am not completely lost.

here is my dilemma now:

this works:
UPDATE "uservalue" SET i_uval_usra_id=4;

but this does not:
UPDATE "uservalue" SET uservalue.i_uval_usra_id=4;
it gets this error:
ODBC Error:ERROR: column "uservalue" of relation "uservalue" does not exist

The second statement is invalid because you shouldn't have a table identifier for each column in the UPDATE statement. You are already specifying the table by doing UPDATE "uservalue" and you can't update more than one table at once (without using rules/views or triggers).

HTH,
-b

thanks. im not sure why i was under the impression that a statement like TABLENAME.FIELDNAME would be harmless. evidently it is.

i work with all kinds of databases every day and so it gets confusing sometimes if SQL syntax is different.

maybe i got the crazy idea from doing stored procedures... i dunno.

thanks. :-)










privacy (GDPR)