Last active
December 11, 2015 00:08
-
-
Save rektide/4513985 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION SPROC_UA_MSG(_forChan INTEGER, _usr INTEGER, _t TIMESTAMP, _msg TEXT) | |
RETURNS void AS | |
$$ | |
DECLARE | |
tmprow msg%ROWTYPE; | |
BEGIN | |
-- [error: relation "tmprow" does not exist] | |
INSERT INTO msg (forChan,usr,t,msg) | |
VALUES(_forChan,_usr,_t,_msg) | |
RETURNING * | |
INTO tmprow; | |
PERFORM pg_notify("msg", row_to_json(rec.*)::TEXT) FROM tmprow AS rec; | |
--PERFORM pg_notify("msg", row_to_json(rec.*)::TEXT) FROM ( | |
-- SELECT _forChan as forChan, _usr as usr, _t as t, _msg as msg | |
--) AS rec; | |
END; | |
$$ | |
LANGUAGE plpgsql; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment