Function to export bytea data from database to a directory

Поиск
Список
Период
Сортировка
От Terry Khatri
Тема Function to export bytea data from database to a directory
Дата
Msg-id CANH4f+jDjcC6rwNPqgoo0qNSHsCdhcOFjaO0VK6EOwDyT4K37Q@mail.gmail.com
обсуждение исходный текст
Список pgsql-admin
Hi
The following function import Images to the database however I wan reverse of it i.e. taking the image out to a directory, I tried to reverse but can not get it right, can some be kind enough to do that for me !!
Many thanks
Terry
 
[code]
 
create or replace function bytea_import(p_path text, p_result out bytea)
                   language plpgsql as $$
declare
  l_oid oid;
  r record;
begin
  p_result := '';
  select lo_import(p_path) into l_oid;
  for r in ( select data
             from pg_largeobject
             where loid = l_oid
             order by pageno ) loop
    p_result = p_result || r.data;
  end loop;
  perform lo_unlink(l_oid);
end;$$;
[/code]

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

Предыдущее
От: Andrew Krause
Дата:
Сообщение: Re: Wal archive way behind in streaming replication
Следующее
От: Devrim Gündüz
Дата:
Сообщение: Re: which slony to start?