Re: row literal problem

Поиск
Список
Период
Сортировка
От Andrew Dunstan
Тема Re: row literal problem
Дата
Msg-id 50070E31.8010006@dunslane.net
обсуждение исходный текст
Ответ на Re: row literal problem  (Merlin Moncure <mmoncure@gmail.com>)
Ответы Re: row literal problem  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On 07/18/2012 03:18 PM, Merlin Moncure wrote:
> On Wed, Jul 18, 2012 at 1:58 PM, Andrew Dunstan <andrew@dunslane.net> wrote:
>> I'm chasing up an issue from a client who has this problem (in 9.1):
>>
>> with q as
>> (
>>      some query here
>> )
>> select q.* from q
>>
>> yields:
>>
>>                     job_scope                   | checked_col
>> -----------------------------------------------+------------------------------------------
>>   Co Revenues: Co Revenues $100 to $999 Million | <input panel=data
>> type=checkbox checked>
>>   Metropolitan Area: Austin-Round Rock          | <input panel=data
>> type=checkbox checked>
>>
>> which is as expected.
>>
>> However,
>>
>> with q as
>> (
>>      same query here
>> )
>> select q from q
>>
>> yields:
>>
>> q
>> -----------------------------------------------------------------------------------------------
>>   ("Co Revenues: Co Revenues $100 to $999 Million","<input panel=data
>> type=checkbox checked>",)
>>   ("Metropolitan Area: Austin-Round Rock","<input panel=data type=checkbox
>> checked>",)
>>
>>
>> Note the trailing comma inside the (), which certainly looks bogus to me. If
>> I replace "select q" with "select row(q.*)" it disappears.
>>
>> It doesn't happen in all cases, and I'm trying to work out a minimal
>> reproducible example. But it sure is puzzling.
> there are no null fields, right? if the last field is sometimes null
> you'd see that (you probably ruled that out though).  when you say
> 'sometimes', do you mean for some rows and not others? or for some
> queries?
>



No, the inner query has two fields.

It happens for all rows, but not for all two-field-resulting queries as 
q. I'm trying to find a simple case rather than the rather complex query 
my customer is using.

cheers

andrew


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

Предыдущее
От: Merlin Moncure
Дата:
Сообщение: Re: row literal problem
Следующее
От: Tom Lane
Дата:
Сообщение: Re: row literal problem