Re: Escaping text / hstore
| От | pinker |
|---|---|
| Тема | Re: Escaping text / hstore |
| Дата | |
| Msg-id | 1445354323182-5870762.post@n5.nabble.com обсуждение исходный текст |
| Ответ на | Re: Escaping text / hstore (Adrian Klaver <adrian.klaver@aklaver.com>) |
| Список | 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.
В списке pgsql-general по дате отправления: