Bug in my ( newbie ) mind? - Mailing list pgsql-general

From Dan Lyke
Subject Bug in my ( newbie ) mind?
Date
Msg-id 14995.23099.624012.744494@wynand.flutterby.com
Whole thread Raw
In response to Bug in my ( newbie ) mind?  (Christopher Sawtell <csawtell@xtra.co.nz>)
Responses Re: Bug in my ( newbie ) mind?
List pgsql-general
Christopher Sawtell writes:
> chris=# select phone_prefix.prefix order by random() limit 1 || '-' ||
> lpad((random()*10000)::int, 4, '0')::text as "Phone Number";
> ERROR:  parser: parse error at or near "||"

This sure won't fix everything, but at the very least you need to
parenthesize that first select clause inside another select. For
instance, this works:

   select (select '123'::text) || (select '456'::text);

So one might think that, with appropriate casting, something more
like:

   select (select phone_prefix.prefix order by random() limit 1) || ...

would be more likely to work (modulo some casting and such).

Dan


pgsql-general by date:

Previous
From: Tod McQuillin
Date:
Subject: Re: Bug in my ( newbie ) mind?
Next
From: Tom Lane
Date:
Subject: Re: Bug in my ( newbie ) mind?