Hi all

Thanks to Andrew Sullivan for getting me started.  I am very close.
This is what I have:

CREATE OR REPLACE FUNCTION slony_ddl() RETURNS TRIGGER AS '
DECLARE
        NewSlonyTableID INTEGER;
        TableName VARCHAR(32);
BEGIN
        IF NEW.column IS NULL THEN

                -- Brand new table being added to slony

        SELECT count(*) INTO NewSlonyTableID FROM
_slony_cluster.sl_table; -- Obtain last used slony table id from slony
table
        NewSlonyTableID := NewSlonyTableID + 1; -- Increment by one
        TableName := "public." || NEW.tablename;
        PERFORM _slony_cluster.storeset (1000, TableName);
        PERFORM _slony_cluster.setaddtable(1000, NewSlonyTableID,
TableName, CAST (NEW.tablename as name), 

CAST (NEW.tablename AS text));

        ELSE
                -- Modifying existing table

        END IF;

        -- Remove row from temp table

        DELETE FROM slony_temp WHERE tablename=NEW.tablename;

        RETURN NEW;

END;
' LANGUAGE plpgsql;

Two things.  In the TableName assignment, I am trying to concatenate
string public. And the table name.  From what I gather in the docs, the
|| should concatentate the two strings.  I am getting an error that
column public doesn't exist.

Why does the following fail?

Quote_literal ("mark adan");

ERROR:  column "mark adan" does not exist

I just want to be able to set a string in a function name

Mark




_______________________________________________
Slony1-general mailing list
[email protected]
http://gborg.postgresql.org/mailman/listinfo/slony1-general

Reply via email to