Problem with coalesce..

Started by George Henry C. Daswaniover 25 years ago4 messagesgeneral
Jump to latest
#1George Henry C. Daswani
gdaswani@esri.com

Hello,

Was wondering if such a call is unsupported, or a bug?

7.0.2 (postgresql, linux redhat 7.0)

SELECT COALESCE ((SELECT NULL,1)

returns a 1, correct..

however..

SELECT COALESCE ((SELECT CURVALUE FROM TABLEKEYS WHERE TABLENAME = 'BUYER'),1)

returns a "UNKNOWN expression type 501"

SELECT CURVALUE FROM TABLEKEYS WHERE TABLENAME = 'BUYER'; returns a '0'

Thanks..

George

In reply to: George Henry C. Daswani (#1)
Re: Problem with coalesce..

Try:

SELECT COALESCE(CURVALUE,1) FROM TABLEKEYS WHERE TABLENAME = 'BUYER';

----- Original Message -----
From: George Henry C. Daswani
To: pgsql-sql@postgresql.org
Cc: pgsql-general@postgresql.org
Sent: Tuesday, October 31, 2000 5:52 PM
Subject: [SQL] Problem with coalesce..

Hello,

Was wondering if such a call is unsupported, or a bug?

7.0.2 (postgresql, linux redhat 7.0)

SELECT COALESCE ((SELECT NULL,1)

returns a 1, correct..

however..

SELECT COALESCE ((SELECT CURVALUE FROM TABLEKEYS WHERE TABLENAME = 'BUYER'),1)

returns a "UNKNOWN expression type 501"

SELECT CURVALUE FROM TABLEKEYS WHERE TABLENAME = 'BUYER'; returns a '0'

Thanks..

George

#3Stephan Szabo
sszabo@megazone23.bigpanda.com
In reply to: George Henry C. Daswani (#1)
Re: Problem with coalesce..

There are still some contexts in which subqueries in expressions are
wierd. The example below appears to work in current sources however.

Stephan Szabo
sszabo@bigpanda.com

On Tue, 31 Oct 2000, George Henry C. Daswani wrote:

Show quoted text

Hello,

Was wondering if such a call is unsupported, or a bug?

7.0.2 (postgresql, linux redhat 7.0)

SELECT COALESCE ((SELECT NULL,1)

returns a 1, correct..

however..

SELECT COALESCE ((SELECT CURVALUE FROM TABLEKEYS WHERE TABLENAME = 'BUYER'),1)

returns a "UNKNOWN expression type 501"

SELECT CURVALUE FROM TABLEKEYS WHERE TABLENAME = 'BUYER'; returns a '0'

Thanks..

George

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Stephan Szabo (#3)
Re: [SQL] Re: Problem with coalesce..

Stephan Szabo <sszabo@megazone23.bigpanda.com> writes:

There are still some contexts in which subqueries in expressions are
wierd. The example below appears to work in current sources however.

SELECT COALESCE ((SELECT CURVALUE FROM TABLEKEYS WHERE TABLENAME = 'BUYER'),1)
returns a "UNKNOWN expression type 501"

AFAICT it works in 7.0.* as well. Are you sure this was 7.0.2, and
not 6.5.something?

regards, tom lane