How can I use uuid_generate_v4() from uuid-ossp? ... and AssertionFailed

Discussion of open issues, suggestions and bugs regarding PgDAC (PostgreSQL Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
jmuehlenhoff
Posts: 36
Joined: Fri 30 Apr 2010 11:25

How can I use uuid_generate_v4() from uuid-ossp? ... and AssertionFailed

Post by jmuehlenhoff » Fri 22 Aug 2014 11:54

Hi,

I'm using UUID for the primary key column in a table like this:

Code: Select all

CREATE TABLE csk.ckind
(
  ckind_id uuid NOT NULL DEFAULT uuid_generate_v4(),
  name text NOT NULL,
  CONSTRAINT pk_ckind PRIMARY KEY (ckind_id)
)
The "uuid_generate_v4()" function is created from the "uui-ossp" addon module http://www.postgresql.org/docs/9.3/stat ... -ossp.html

The problem is that the function is in the "default" schema whereas the table is in the "coating_specs_kunden" schema.

When I try to add a row using TPgTable / TPgQuery it does not work.

With default settings the database complains that the "ckind_id" field must have a value.

With "Options.DefaultValues := True" the TPgTable complains with "function uuid_generate_v4() does not exist.".

Furthermore this also leads to an assertion failure later: "Exception EAssertionFailed in Modul Project1.exe bei 0017CA63.

TCompressedBlob.Free RefCount = 0 (D:\Projects\Delphi\Dac\Common\Source\MemData.pas, Zeile 8512)."

Any ideas?

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: How can I use uuid_generate_v4() from uuid-ossp? ... and AssertionFailed

Post by azyk » Wed 27 Aug 2014 11:43

To solve the problem with the "function uuid_generate_v4() does not exist." error, before connecting, add the schema name ("default"), which contains the uuid_generate_v4() function, to the TPgConnection.Schema property. For example:

PgConnection.Schema := 'coating_specs_kunden,"default"';

jmuehlenhoff
Posts: 36
Joined: Fri 30 Apr 2010 11:25

Re: How can I use uuid_generate_v4() from uuid-ossp? ... and AssertionFailed

Post by jmuehlenhoff » Wed 27 Aug 2014 13:21

That worked, thanks!

The AsserionFailed is also gone now, so it must be a follow up error.

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: How can I use uuid_generate_v4() from uuid-ossp? ... and AssertionFailed

Post by azyk » Fri 29 Aug 2014 07:17

It is good to see that the problem has been solved. Feel free to contact us if you have any further questions about PgDAC.

Post Reply