Default values fail with a postgres database #758

Closed
Speedrockracer opened this Issue Dec 20, 2012 · 5 comments

Comments

Projects
None yet
3 participants

Hey guys,

My table looks something like this:

CREATE TABLE tablename
(
id uuid not null,
link_to_other_table uuid NOT NULL DEFAULT '98c11581-4505-11e2-bcfd-0800200c9a66'::uuid,
other fields....
)

Now that would not realy be a proper uuid but anyways. When I attempt to add a record with something like this

$model = Model::create();
$model->save($data);

I get an error telling met that Lithium attempts to insert "98c11581-4505-11e2-bcfd-0800200c9a66'::uuid" in the link_to_other_table field.
That sould either be nothing because postgres will fill the field itself with the default value or just the uuid and not the type declaration.

Thank you very much!

Greetz,
Speedrock

Owner

nateabele commented Dec 20, 2012

Yeah, looks like the Postgres adapter needs a better parser for its default values in describe().

Further testing reveals that boolean fields with a default value set to false will always default to true. Same issue.

Greetz,
Speedrock

Owner

nateabele commented Dec 21, 2012

What does the default value look like when it comes back to PHP?

Strings containing 'true' and 'false'.

Contributor

jails commented Apr 30, 2013

Thanks for reporting, sould have been solved in #905 (currenlty merged in the dev branch).
Feel free to repoen the issue if it has not completly solved.

@jails jails closed this Apr 30, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment