anyrecord/anyelement escaping question.

Поиск
Список
Период
Сортировка
От Marc Mamin
Тема anyrecord/anyelement escaping question.
Дата
Msg-id B6F6FD62F2624C4C9916AC0175D56D8828A3585F@jenmbs01.ad.intershop.net
обсуждение исходный текст
Список pgsql-general
Hello,
 
I'd  like to store  some "special" record of a list of tables in a single table for later reimport:
 
e.g.:
 
table t1 (a int, b int)
table t2 (c int, t varchar)
 
myTable (tsource text   trecord text):
 
t1, (1,2)
t1, (3,18)
t2, (1,'a b')
 
Later I will be able to populate t1 or t2 tables using the content of myTable
something like :
 
EXECUTE 'insert into '||tsource||' values '||trecord FROM myTable.
 
What I'm looking for is a "record escaping" function that would put the single quotes as required later on from a table.
 
e.g. select somefunc(t2) from t2:
 
somefunc
text
-------
1,'a b'
 
 
I could be  happy too with such a function on anyelement:
 
select escape(c)||','||escape(t)  from t2
 
 
 
Is there some built in function I can use for this, or do I have to write it from scratch:
 
create function myescape(a anyelement, OUT escaped text) as $$
 
..
select case when typeof(a) =   then
            when typeof(a) =   then
            when typeof(a) =   then
            when typeof(a) =   then
..
 
 
regards,
 
Marc Mamin
 

В списке pgsql-general по дате отправления:

Предыдущее
От: itishree sukla
Дата:
Сообщение: Multi Master Replication
Следующее
От: Rahila Syed
Дата:
Сообщение: Re: Replication: GZIP compression in WAL sender/receiver processes communication?