Page 1 of 1

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

Posted: Fri 22 Aug 2014 11:54
by jmuehlenhoff
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?

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

Posted: Wed 27 Aug 2014 11:43
by azyk
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"';

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

Posted: Wed 27 Aug 2014 13:21
by jmuehlenhoff
That worked, thanks!

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

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

Posted: Fri 29 Aug 2014 07:17
by azyk
It is good to see that the problem has been solved. Feel free to contact us if you have any further questions about PgDAC.