Revision 10135
Added by Aaron Marcuse-Kubitza over 11 years ago
schemas/util.sql | ||
---|---|---|
948 | 948 |
CREATE FUNCTION mk_const_col(col col_ref, value anyelement) RETURNS void |
949 | 949 |
LANGUAGE sql STRICT |
950 | 950 |
AS $_$ |
951 |
SELECT util.create_if_not_exists($$ALTER TABLE $$||$1.table_||$$ ADD COLUMN $$ |
|
951 |
SELECT util.create_if_not_exists($$ |
|
952 |
ALTER TABLE $$||$1.table_||$$ ADD COLUMN $$ |
|
952 | 953 |
||quote_ident($1.name)||$$ $$||pg_typeof($2)||util.type_qual($2)||$$ DEFAULT $$ |
953 |
||quote_literal($2)) |
|
954 |
||quote_literal($2)||$$; |
|
955 |
COMMENT ON COLUMN $$||$1.table_||$$.$$||quote_ident($1.name)||$$ IS 'constant'; |
|
956 |
$$) |
|
954 | 957 |
$_$; |
955 | 958 |
|
956 | 959 |
|
Also available in: Unified diff
schemas/util.sql: mk_const_col(): add column comment "constant" to mark column as inlinable (needed by some mappings to have a literal value to compare)