Thread: select from sequences
Hi, just for curiosity, why the code doesn't throw an error when using sequences in the from_list of a select? allow selects from sequences confuses many people about the correct way of using sequences -- regards, Jaime Casanova "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs and the universe trying to produce bigger and better idiots. So far, the universe is winning." Richard Cook
"Jaime Casanova" <systemguards@gmail.com> writes: > just for curiosity, why the code doesn't throw an error when using > sequences in the from_list of a select? That's a feature, not a bug. regards, tom lane
On 2/11/07, Tom Lane <tgl@sss.pgh.pa.us> wrote: > "Jaime Casanova" <systemguards@gmail.com> writes: > > just for curiosity, why the code doesn't throw an error when using > > sequences in the from_list of a select? > > That's a feature, not a bug. > and why is this a feature? i mean, what real use it has? -- regards, Jaime Casanova "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs and the universe trying to produce bigger and better idiots. So far, the universe is winning." Richard Cook
"Jaime Casanova" <systemguards@gmail.com> writes: > and why is this a feature? i mean, what real use it has? To find out the parameters of an existing sequence. Remove it and you'll break pg_dump, to say nothing of any other application. regards, tom lane
On 2/11/07, Jaime Casanova <systemguards@gmail.com> wrote: > On 2/11/07, Tom Lane <tgl@sss.pgh.pa.us> wrote: > > "Jaime Casanova" <systemguards@gmail.com> writes: > > > just for curiosity, why the code doesn't throw an error when using > > > sequences in the from_list of a select? > > > > That's a feature, not a bug. > > > > and why is this a feature? i mean, what real use it has? I use it all the time. You can query the sequence for its last value without using it first. This is a lot more useful than it appears on the surface. merlin