[GENERAL] Bug in my ( newbie ) mind?

2001-02-20 Thread Christopher Sawtell
Greetings, Please, what am I doing wrong? chris=# \d phone_prefix Table "phone_prefix" -[ RECORD 1 ]-- Attribute | number Type | integer Modifier | not null default nextval('"phone_prefix_number_seq"'::text) -[ RECORD 2

Re: [GENERAL] Bug in my ( newbie ) mind?

2001-02-20 Thread Tod McQuillin
On Wed, 21 Feb 2001, Christopher Sawtell wrote: chris=# select phone_prefix.prefix order by random() limit 1 || '-' || lpad((random()*1)::int, 4, '0')::text as "Phone Number"; All the things you are selecting need to come in the first part of the query. like, SELECT prefix || '-' ||

[GENERAL] Bug in my ( newbie ) mind?

2001-02-20 Thread Dan Lyke
Christopher Sawtell writes: chris=# select phone_prefix.prefix order by random() limit 1 || '-' || lpad((random()*1)::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

Re: [GENERAL] Bug in my ( newbie ) mind?

2001-02-20 Thread Tom Lane
Dan Lyke [EMAIL PROTECTED] writes: 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). Note this will not work in pre-7.1 releases --- 7.1