Unidac driver error message with Postgres

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Nols Smit
Posts: 15
Joined: Tue 11 Aug 2009 06:04

Unidac driver error message with Postgres

Post by Nols Smit » Tue 29 Sep 2009 09:59

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

tobias_cd
Posts: 56
Joined: Thu 18 Dec 2008 22:10

Post by tobias_cd » Tue 29 Sep 2009 12:18

Does your database use referential integrity with foreign keys/constraints?

Nols Smit
Posts: 15
Joined: Tue 11 Aug 2009 06:04

Unidac driver error message with Postgres

Post by Nols Smit » Tue 29 Sep 2009 17:53

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

Nols Smit
Posts: 15
Joined: Tue 11 Aug 2009 06:04

Unidac driver error message with Postgres

Post by Nols Smit » Tue 29 Sep 2009 19:52

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

Post Reply