From: | pinker <pinker(at)onet(dot)eu> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Escaping text / hstore |
Date: | 2015-10-20 15:18:43 |
Message-ID: | 1445354323182-5870762.post@n5.nabble.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Adrian Klaver-4 wrote
> Here is my very similar function:
>
> CREATE OR REPLACE FUNCTION utility.archive_del_record() RETURNS trigger AS
> $BODY$
> DECLARE
> tbl_name text := TG_TABLE_NAME || '_delete' ;
> archive_row hstore := hstore(OLD.*);
> user_name text := session_user;
> BEGIN
> EXECUTE 'INSERT INTO ' ||quote_ident(tbl_name) ||
> '(record_fld, del_ts, del_user)'
> || ' VALUES('||quote_literal(archive_row)||', now(),' ||
> quote_literal(user_name)||')';
> RETURN OLD;
> END;
> $BODY$
> LANGUAGE plpgsql SECURITY DEFINER;
Thank you Adrian you made my day!
I compared our functions and came out that the problem was only in quotes...
I have used 3 of them and with hstore one is enough.
--
View this message in context: http://postgresql.nabble.com/Escaping-text-hstore-tp5870728p5870762.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.
From | Date | Subject | |
---|---|---|---|
Next Message | Pavel Stehule | 2015-10-20 15:21:00 | Re: My first PL/pgSQL function |
Previous Message | Tomas Vondra | 2015-10-20 15:14:06 | Re: RAID and SSD configuration question |