Re: psql: add \pset true/false

Поиск
Список
Период
Сортировка
От Kyotaro HORIGUCHI
Тема Re: psql: add \pset true/false
Дата
Msg-id 20151203.145330.216602814.horiguchi.kyotaro@lab.ntt.co.jp
обсуждение исходный текст
Ответ на Re: psql: add \pset true/false  (Michael Paquier <michael.paquier@gmail.com>)
Ответы Re: psql: add \pset true/false  (Michael Paquier <michael.paquier@gmail.com>)
Список pgsql-hackers
Hello, the attched is an example implement of output filter
dynamic loading feature of psql.

At Thu, 3 Dec 2015 10:41:11 +0900, Michael Paquier <michael.paquier@gmail.com> wrote in
<CAB7nPqSuLVD0m8GWkL2bar4SuxrwY2+YBYmTBm0UT4At7jg_8Q@mail.gmail.com>
> > How about plugins on psql side? Calling hooked function in
> > printQuery could do that on psql. Impact on psql itself is
> > minimized. (Of course code for loading is omitted in the below
> > but it would also small...)
> 
> That's interesting, and crazy. You would basically need to have the
> equivalent of \load, or an environment variable like PSQL_SHARED_LIBS
> that is similar to shared_preload_libraries on client-side. In short I
> guess that's actually a clone of LD_PRELOAD.

It is bothersome to share the server-side preload feature so I
made this as a minimal implement. Some safety meature should be
added but not so severe than backend. I home this is an
acceptable mess.

The attached patch adds a function to load output filter DLL.
The second file is an example filter module. The following
commandline with the file can create a test filter module. I
suppose preload feature only needs additional few lines.

gcc -I<pgsql_include> -fPIC -shared outfunctest.c -o /tmp/outfunctest.so

Then, on psql command line.

=# select 't'::bool;bool 
------t
=# \load_dll /tmp/outfunctest.so
=# select 't'::bool;  bool    
-----------TRRRRUEEE
(1 row)

Anyone can tweak any type of output by this.

Opinions, suggestions or rejections are welcome.

regards,

-- 
Kyotaro Horiguchi
NTT Open Source Software Center



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

Предыдущее
От: Amit Langote
Дата:
Сообщение: Re: [PROPOSAL] VACUUM Progress Checker.
Следующее
От: Catalin Iacob
Дата:
Сообщение: Re: proposal: PL/Pythonu - function ereport