Re: [GENERAL] Using 'WITH SELECT' Results Do Not Match 'SELECT FROM ' Results Поиск
Список
Период
Сортировка
От Jerry Regan
Тема Re: [GENERAL] Using 'WITH SELECT' Results Do Not Match 'SELECT FROM ' Results
Дата
Msg-id 1C8519B5-03C1-4CE9-A2F3-24C8225E5A82@concertoglobalresources.com
обсуждение исходный текст
Ответ на Re: [GENERAL] Using 'WITH SELECT' Results Do Not Match 'SELECT FROM' Results  (Adrian Klaver <adrian.klaver@aklaver.com>)
Список pgsql-general
Adrian,

Working from my phone wasn't such a good idea!

When I said 'INSERT' I meant 'WITH'. My excuse is that the 'WITH' statement is building a temporary table ( at least
logically) so there is at least an implicit 'INSERT' there. 

/s/jr
Sent from my iPhone

> On Jul 3, 2017, at 23:12, Adrian Klaver <adrian.klaver@aklaver.com> wrote:
>
>> On 07/03/2017 05:20 PM, Jerry Regan wrote:
>> Adrian,
>> Thank you for your reply!
>> I apologize in advance for not being detailed below. Hard to do from my phone.
>> I did have to move the 'ORDER BY', but not outside the 'WITH'. My first workaround parenthesized the select
containingthe 'ORDER BY', forcing it to be evaluated before the 'INSERT'. That worked. 
>
> Not sure where the INSERT comes into the picture, but glad you got it working.
>
>> But I never liked using a sequence for the c_id column. And using the sequence on my personal workstation was maybe
safe,but given that sequences not are guaranteed to be without gaps, that was not very portable. 
>
> Yeah, that concerned me also, still I figured one problem at a time.
>
>> So I searched a bit and found I could use 'row_number()' instead. That approach allowed me to use the 'ORDER BY'
requiredby 'row_number()'. 
>> That worked and is far more portable to other postgresql instances.
>> I really do appreciate your response. It is also my nature to continue my research even after asking for help.
HoweverI find my answer, one validates the other. 
>
> Sometimes it just a matter a little push to get out of the rut:)
>
>> Thanks again!
>> /s/jr
>> Sent from my iPhone
>
>
> --
> Adrian Klaver
> adrian.klaver@aklaver.com


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

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: [GENERAL] Using 'WITH SELECT' Results Do Not Match 'SELECT FROM' Results
Следующее
От: Moreno Andreo
Дата:
Сообщение: [GENERAL] Invalid field size