Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Default values fail with a postgres database #758

Closed
Speedrockracer opened this Issue · 5 comments

3 participants

@Speedrockracer

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

@nateabele
Owner

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

@Speedrockracer

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

Greetz,
Speedrock

@nateabele
Owner

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

@Speedrockracer

Strings containing 'true' and 'false'.

@jails
Collaborator

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.