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

Reply via email to