Re: proposal - assign result of query to psql variable

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: proposal - assign result of query to psql variable
Дата
Msg-id 25422.1359759365@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: proposal - assign result of query to psql variable  (Pavel Stehule <pavel.stehule@gmail.com>)
Ответы Re: proposal - assign result of query to psql variable  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-hackers
Pavel Stehule <pavel.stehule@gmail.com> writes:
> here is patch related to your proposal

I looked at this a bit.  It's getting there, though I still don't trust
the places where you've chosen to clear the prefix setting.  (Looking at
it, I'm now not sure that I trust the implementation of \g either.)

However, what I wanted to ask about was this:

> +             if (PQgetisnull(result, 0, i))
> +                 value = pset.popt.nullPrint ? pset.popt.nullPrint : "";
> +             else
> +                 value = PQgetvalue(result, 0, i);

What's the argument for using nullPrint here?  ISTM that's effectively a
form of escaping, and I'd not expect that to get applied to values going
into variables, any more than any other formatting we do when printing
results.

Admittedly, if we just take the PQgetvalue result blindly, there'll
be no way to tell the difference between empty-string and NULL results.
But I'm not convinced that this approach is better.  It would certainly
need more than no documentation.
        regards, tom lane



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

Предыдущее
От: Christopher Browne
Дата:
Сообщение: Re: autovacuum not prioritising for-wraparound tables
Следующее
От: Tom Lane
Дата:
Сообщение: Re: json api WIP patch