On Aug 20, 2013, at 3:18 PM, Pavel Stehule <pavel.steh...@gmail.com> wrote:

> can you show some examples, please

This is not dissimilar to what I am actually doing:

    CREATE TABLE foo (id SERIAL PRIMARY KEY, name TEXT);

    CREATE OR REPLACE FUNCTION shipit (
        VARIADIC things TEXT[]
    ) RETURNS BOOL LANGUAGE plpgsql AS $$
    BEGIN
        WITH inserted AS (
            INSERT INTO foo (name)
            SELECT * FROM unnest(things)
            RETURNING id
        )
        PERFORM pg_notify(
            'inserted ids',
            ARRAY(SELECT * FROM inserted)::text
        );
        RETURN FOUND;
    END;
    $$;

Only I am using a dummy row variable instead of PERFORM, of course.

Best,

David



-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to