Re: RfD: more powerful "any" types

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: RfD: more powerful "any" types
Дата
Msg-id 20090910171320.GD31165@alvh.no-ip.org
обсуждение исходный текст
Ответ на Re: RfD: more powerful "any" types  (Pavel Stehule <pavel.stehule@gmail.com>)
Ответы Re: RfD: more powerful "any" types  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: RfD: more powerful "any" types  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-hackers
Pavel Stehule escribió:

> Please, try to compile and run sprintf function from attachment

There's a minor bug in the comparison to PG_NARGS() inside the loop,
fixed in this version.

The one problem I have with this is that if the format string does not
contain any % (and thus there is no extra argument), it errors out:

alvherre=# select text_format('ouch');
ERROR:  function text_format(unknown) does not exist
LÍNEA 1: select text_format('ouch');
                ^
SUGERENCIA:  No function matches the given name and argument types. You might need to add explicit type casts.

AFAICS fixing this would require a second pg_proc entry for this
function.


alvherre=# select text_format('% was % at % and said % % times', 'Pavel'::text, 'here'::unknown, now(),
row('a','b','c'),'{42}'::int[]); 
                                 text_format
-----------------------------------------------------------------------------
 Pavel was here at 2009-09-10 13:12:09.054653-04 and said (a,b,c) {42} times
(1 fila)

--
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

Вложения

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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: CommitFest 2009-09 Plans and Call for Reviewers
Следующее
От: Tom Lane
Дата:
Сообщение: Re: RfD: more powerful "any" types