问题描述:

We have postgres 8 installed on a linux box, and I'm copying over data and triggers from our windows version to this new one. However, plpgsql isn't installed by default, so copying my trigger source is failing. I only have C or Internal languages to choose from; barring asking the DBA to install plpgsql, can anyone help me convert this:

CREATE OR REPLACE FUNCTION "datestampTrigger"()

RETURNS "trigger" AS

'BEGIN

-- check for datecreated

IF NEW.datecreated IS NULL THEN

NEW.datecreated := ''now'';

END IF;

NEW.datelastmodified := ''now'';

RETURN NEW;

END;'

LANGUAGE plpgsql VOLATILE;

网友答案:

On most linux systems I have encountered plpgsql is actually installed on the system but is not included in the database template. Executing the following "activates" plpgsql in your database.

CREATE LANGUAGE plpgsql;
相关阅读:
Top