Page 1 of 1

Unidac driver error message with Postgres

Posted: Tue 29 Sep 2009 09:59
by Nols Smit
Hi,

When tying to update a table using Delphi 7, Unidac and Postgres, I get the
message:

EPgError Column "id" of relation "PROJ_TYPE" does not exist


I have no problems to update a similar FireBird database, with the same program, when I use a
InterBaseUniProvider.

The table has two columns: ID and DESCRIPTION. If I drop ID, then I get
the same error message on DESCRIPTION.



Regards,

Nols Smit

Posted: Tue 29 Sep 2009 12:18
by tobias_cd
Does your database use referential integrity with foreign keys/constraints?

Unidac driver error message with Postgres

Posted: Tue 29 Sep 2009 17:53
by Nols Smit
Hi,

The database has only one table with two columns. The DDL:

CREATE TABLE "public"."PROJECTS" (
"ID" SERIAL,
"DESCRIPTION" VARCHAR(20),
CONSTRAINT "PROJECTS_pkey" PRIMARY KEY("ID")
) WITHOUT OIDS;

I'm using EMS IBManager for Postgres and I test my SQL in it's Query Builder or SQL Editor before using it in Delphi.
Typically the Select statement has the following syntax:
SELECT * FROM public."PROJ_TYPE"
where the schema name is public.

My test Delphi program does display the table's data in a DB grid but when I do an insert by using the DBNavigator, I get the mentioned error message.


Regards,

Nols Smit

Unidac driver error message with Postgres

Posted: Tue 29 Sep 2009 19:52
by Nols Smit
Yes, I figured it out.

The Column names must also be quoted and the SQL is case sensitive. Therefore my insert SQL must be:

INSERT INTO public."PROJ_TYPE"
("DESCRIPTION")
VALUES
(:DESCRIPTION)

and not as generated by TUniQuery

INSERT INTO public."PROJ_TYPE"
(id, description)
VALUES
(:ID, :DESCRIPTION)




Regards,

Nols Smit