On Mon, Aug 29, 2011 at 9:00 AM, Kevin Grittner
wrote:
> Merlin Moncure wrote:
>
>> yeah, that's the correct way, but why does this work?
>> select val from random() as val;
>
> If you look at the PostgreSQL reference docs for the SELECT
> statement, a from_item can be a SELECT statement in paren
Alexey Klyukin writes:
> On Aug 29, 2011, at 5:47 PM, Tom Lane wrote:
>> There is a dump/reload bug though :-( ... if you were to do
>>
>> create view vv as select val from CAST(random() as integer) as val;
>>
>> you will find that the system prints it out with the :: syntax,
>> which won't wor
On Aug 29, 2011, at 5:47 PM, Tom Lane wrote:
> "Kevin Grittner" writes:
>> Merlin Moncure wrote:
>>> yeah, that's the correct way, but why does this work?
>>> select val from random() as val;
>
>> If you look at the PostgreSQL reference docs for the SELECT
>> statement, a from_item can be a SE
"Kevin Grittner" writes:
> Merlin Moncure wrote:
>> yeah, that's the correct way, but why does this work?
>> select val from random() as val;
> If you look at the PostgreSQL reference docs for the SELECT
> statement, a from_item can be a SELECT statement in parentheses or a
> function call (amo
"Kevin Grittner" wrote:
> test=# select val from (select 'a' = 'a') as val;
> val
> -
> (t)
> (1 row)
Also note the difference between a record and a scalar here. I
forgot to write it to return val as a scalar, which seems to be what
you're after. It should have been:
test=# select v
Alexey Klyukin wrote:
> On Aug 29, 2011, at 5:02 PM, Kevin Grittner wrote:
>
>> Alexey Klyukin wrote:
>>
>>> Function calls can appear in the FROM clause. (This is
>>> especially useful for functions that return result sets, but any
>>> function can be used.) This acts as though its output were
On Aug 29, 2011, at 5:02 PM, Kevin Grittner wrote:
> Alexey Klyukin wrote:
>
>> Function calls can appear in the FROM clause. (This is especially
>> useful for functions that return result sets, but any function can
>> be used.) This acts as though its output were created as a
>> temporary tabl
Alexey Klyukin wrote:
> Function calls can appear in the FROM clause. (This is especially
> useful for functions that return result sets, but any function can
> be used.) This acts as though its output were created as a
> temporary table for the duration of this single SELECT command.
It doesn
Merlin Moncure wrote:
> yeah, that's the correct way, but why does this work?
> select val from random() as val;
If you look at the PostgreSQL reference docs for the SELECT
statement, a from_item can be a SELECT statement in parentheses or a
function call (among other things). It cannot be an
On Mon, Aug 29, 2011 at 7:49 AM, Kevin Grittner
wrote:
> Alexey Klyukin wrote:
>
>> The following statement produces an error message in PostgreSQL 8.4
>> - 9.2 (head):
>>
>> postgres=# select val from random()::integer as val;
>
>> The same statement rewritten with CAST AS works as expected:
>>
On Aug 29, 2011, at 3:49 PM, Kevin Grittner wrote:
> Alexey Klyukin wrote:
>
>> The following statement produces an error message in PostgreSQL 8.4
>> - 9.2 (head):
>>
>> postgres=# select val from random()::integer as val;
>
>> The same statement rewritten with CAST AS works as expected:
>>
Alexey Klyukin wrote:
> The following statement produces an error message in PostgreSQL 8.4
> - 9.2 (head):
>
> postgres=# select val from random()::integer as val;
> The same statement rewritten with CAST AS works as expected:
>
> postgres=# select val from CAST(random() as integer) as val;
Hello,
The following statement produces an error message in PostgreSQL 8.4 - 9.2
(head):
postgres=# select val from random()::integer as val;
ERROR: syntax error at or near "::"
LINE 1: select val from random()::integer as val;
The same statement rewritten with CAST AS works as expected:
13 matches
Mail list logo