Re: Aliased table names ...oddity? - Mailing list pgsql-novice

From
Subject Re: Aliased table names ...oddity?
Date
Msg-id 20050706160156.2933.qmail@web33305.mail.mud.yahoo.com
Whole thread Raw
In response to Re: Aliased table names ...oddity?  ("Obe, Regina DND\\MIS" <robe.dnd@cityofboston.gov>)
Responses User Defined Note Order Problem
List pgsql-novice
i think this is related to a pgsql gotcha...  see
1.1...

http://sql-info.de/postgresql/postgres-gotchas.html

--- "Obe, Regina     DND\\MIS"
<robe.dnd@cityofboston.gov> wrote:

> Yes - in the postgresql.conf there is an
> "add_missing_from" option - change
> that to false.  I think by default it is on, and in
> future versions they are
> planning to set that to false.
>
> -----Original Message-----
> From: Steve Tucknott [mailto:steve@retsol.co.uk]
> Sent: Thursday, June 30, 2005 2:55 AM
> To: PostGreSQL
> Subject: [NOVICE] Aliased table names ...oddity?
>
>
> PostgreSQL-7.4.5
>
> I don't know whether this is a 'bug' (it seems like
> designed behaviour)
> - but if you do:
> SELECT markUp.*
> FROM markUp AS mark
>      JOIN clientBranch AS clntB
>      ON   mark.foreignRecNo      = clntB.clientRecNo
>      AND  clntB.recNo            = 2
> WHERE mark.serviceCoBranchRecNo  = 2
> AND   mark.foreignTableName      = 'client'
>
>
> So the table has an ALIAS that is ignored in the
> SELECT clause, then the
> WHERE clause is 'ignored' and all rows from the
> table are returned.
> Obviously its a typo in the original SQL - (but one
> that's very difficult to
> pick up unless the data returned is obviously
> outside limits). Running the
> SQL in PSQL, it seems that a FROM clause is
> automatically appended for the
> missing 'markUp' table - so it does seem that this
> is intentional. Is there
> a way to have this 'rejected' as an error - ie
> selecting from a table not
> included in the query?
>
>
> --
>
>
> Regards,
>
> Steve Tucknott
> ReTSol Ltd
>
> DDI    01903 828769
> MOBILE    07736715772
>
>
>
>
>
>
___________________________________________________________
>
> Yahoo! Messenger - NEW crystal clear PC to PC
> calling worldwide with
> voicemail http://uk.messenger.yahoo.com
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please
> send an appropriate
>        subscribe-nomail command to
> majordomo@postgresql.org so that your
>        message can get through to the mailing list
> cleanly
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
>                http://www.postgresql.org/docs/faq
>


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: Rules and transactions
Next
From: "Celia McInnis"
Date:
Subject: Re: array to rows of it's elements?