Re: [BUGS] General Bug Report: empty SELECT WHEREs return error

From: Fomichev Michael <fomichev(at)null(dot)ru>
To: Austin Schutz <tex(at)habit(dot)com>
Cc: pgsql-bugs(at)postgreSQL(dot)org
Subject: Re: [BUGS] General Bug Report: empty SELECT WHEREs return error
Date: 1999-06-23 19:54:45
Message-ID: Pine.LNX.4.04.9906240852110.453-100000@ns.region.utsr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, 23 Jun 1999, Unprivileged user wrote:

> Your name : Austin Schutz
> Your email address : tex(at)habit(dot)com
>
> Category : runtime: back-end: SQL
> Severity : serious
>
> Summary: empty SELECT WHEREs return error
>
> System Configuration
> --------------------
> Operating System : SunOS 5.6
>
> PostgreSQL version : 6.0
>
> Compiler used : gcc 2.8.1
>
> Problem Description:
> --------------------
> select * from foo where bar = "baz"
> produces "ERROR: attribute 'hna' not found"
> if there is no row with bar == "baz".
> Rather than errorring an empty set should be returned.
> This is important for cross-db-portable applications
> which need to know whether a legitimate query returns
> no rows vs. a 'bad' query.
> It would be possible to test the error response for
> being the specific 'attribute not found' error, but this is
> extremely un-portable behavior (code would only work on
> postgres) and further would mask cases where column bar
> doesn't exist and the 'attribute not found' error is
> correct.
>
> --------------------------------------------------------------------------
>
> Test Case:
> ----------
> create table foo (bar char(1));
> select * from foo where ( bar = "baz" );
> ERROR: attribute 'baz' not found
>
You should use a single quotes:
create table foo (bar char(1));
select * from foo where bar='baz';
bar
---
(0 rows)

@------------------+-----------------------------------------------@
| Fomichev Michail | The Government of Kamchatka region. |
|<fomichev(at)null(dot)ru>| The Labour and Social Development Department. |
`------------------+-----------------------------------------------'

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Austin Schutz 1999-06-23 20:18:45 Re: [BUGS] General Bug Report: empty SELECT WHEREs return error
Previous Message Unprivileged user 1999-06-23 08:34:49 General Bug Report: empty SELECT WHEREs return error