Re: Column name validation in embedded query.

From: Dave Page <dpage(at)vale-housing(dot)co(dot)uk>
To: Lori Pate <lpate(at)opushealthcare(dot)com>, <pgadmin-support(at)postgresql(dot)org>
Subject: Re: Column name validation in embedded query.
Date: 2005-11-07 19:35:37
Message-ID: BF955D09.50C2%dpage@vale-housing.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support

On 7/11/05 2:55 pm, "Lori Pate" <lpate(at)opushealthcare(dot)com> wrote:

> I am using pgAdmin III, PostgreSQL tools, Version 1.2.0 Beta on Windows XP
> Pro.
>
> The following query, when executed as a stand alone query returns an error,
> correctly, that the column name is not valid:
>
> Query A) Select patientorder_key from patientorder where visit_key = 250314
> and provider_key = 301;
>
> The correct syntax should be:
> Query B) Select patientorder.key from patientorder where visit_key = 250314
> and provider_key = 301;
>
> However, when the query with the incorrect column name (Query A) is embedded
> in a where clause, column validation does not happen, no error is displayed,
> and PGAdmin apparently ignores the where clause all together, resulting in
> complete data deletion, as if there were no where clause:
>
> Begin;
> Delete from testorder where patientorder_key in
> (Select patientorder_key from patientorder where visit_key = 250314 and
> provider_key = 301);
> End;
>
> This resulted in massive amounts of data being deleted erroneously.
>
> I believe this is a bug.

Not in pgAdmin. pgAdmin passes the query verbatim to PostgreSQL, making no
attempt to parse or understand it at all. PostgreSQL parses, plans and
executes the query and returns any resulting data or messages to pgAdmin
which displays it/them.

I would suggest producing an easily re-createable test case and posting it
to pgsql-bugs(at)postgresql(dot)org(dot)

Regards, Dave

In response to

Browse pgadmin-support by date

  From Date Subject
Next Message Jean-Pierre Pelletier 2005-11-07 20:24:37 Re: Column name validation in embedded query.
Previous Message Hendrik-Jan Heins 2005-11-07 19:32:21 pgadmin3 1.4.0 for Mandriva