Re: the '::' cast doesn't work in the FROM clause
От | Merlin Moncure |
---|---|
Тема | Re: the '::' cast doesn't work in the FROM clause |
Дата | |
Msg-id | CAHyXU0x-MgGEfa+P4+6fR=4q2k542P58QBQqn7cWcEqU3sdGTg@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: the '::' cast doesn't work in the FROM clause ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>) |
Ответы |
Re: the '::' cast doesn't work in the FROM clause
|
Список | pgsql-bugs |
On Mon, Aug 29, 2011 at 7:49 AM, Kevin Grittner <Kevin.Grittner@wicourts.gov> wrote: > Alexey Klyukin =A0wrote: > >> The following statement produces an error message in PostgreSQL 8.4 >> - 9.2 (head): >> >> postgres=3D# select val from random()::integer as val; > >> The same statement rewritten with CAST AS works as expected: >> >> postgres=3D# select val from CAST(random() as integer) as val; > >> The documentation says these casts are equivalent, so either that's >> wrong, or this is a bug. > > Please point out where you think the documentation says that. =A0The > way I read it, this is the correct syntax: > > test=3D# select val from (select random()::integer) as x(val); > =A0val > ----- > =A0 1 > (1 row) > > Not only are you missing required parentheses and the SELECT keyword, > you're returning a record rather than a scalar value. yeah, that's the correct way, but why does this work? select val from random() as val; That's illegal IMO, and walls you off from syntax (like::) you normally should be able to use. merlin
В списке pgsql-bugs по дате отправления: