[PostgreSQL] function as default values
Database management in a single PHP file
Brought to you by:
jakubvrana
When inserting in a table that uses function to generate default values, adminer insert query tries to insert the function "call" instead of the result of the call, eg:
with this table:
CREATE TABLE tag (
"id" uuid NOT NULL PRIMARY KEY DEFAULT uuid_generate_v4(),
"name" character varying NOT NULL
);
adminer generate the following query:
INSERT INTO "tag" ("id", "name")
VALUES ('uuid_generate_v4()', 'tag name');
instead of
INSERT INTO "tag" ("id", "name")
VALUES (uuid_generate_v4(), 'tag name');
Maybe its a regression but version 4.6.2 and a build based upon master on github still seem to convert default function calls into textual values.
ERROR: invalid input syntax for type uuid: "uuid_generate_v4()" LINE 2: VALUES ('uuid_generate_v4()')Altering table with default value
uuid_generate_v4()generates: