Check if a string is a function. And call this string with arguments. Update SQL files for better layout order
13 lines
297 B
PL/PgSQL
13 lines
297 B
PL/PgSQL
-- adds the created or updated date tags
|
|
|
|
CREATE OR REPLACE FUNCTION set_uid() RETURNS TRIGGER AS '
|
|
DECLARE
|
|
random_length INT = 32; -- that should be long enough
|
|
BEGIN
|
|
IF TG_OP = ''INSERT'' THEN
|
|
NEW.uid := random_string(random_length);
|
|
END IF;
|
|
RETURN NEW;
|
|
END;
|
|
' LANGUAGE 'plpgsql';
|