Re: [HACKERS] It would be nice if this could be fixed...

From: Chris Bitmead <chris(dot)bitmead(at)bigfoot(dot)com>
To: pgsql-hackers(at)hub(dot)org
Subject: Re: [HACKERS] It would be nice if this could be fixed...
Date: 1999-04-27 10:07:41
Message-ID: 37258C6D.23891317@bigfoot.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

The Hermit Hacker wrote:

> As D'Arcy did ask...which oid would you want used? The one from table a,
> or from Table b?

Just like any situation where column names conflict, the answer is
"whichever one I say".

If I have a join then I would say
CREATE view productv as SELECT product.oid, product.name, mfr.name from
product, mfr where product.mfr = mfr.oid;

This is no different from any other case where you join two tables with
same column names. Only difference is that it doesn't work :-(.

>They are two distinctly different numbers...the VIEW
> itself doesn't have an OID assigned to its rows,

Exactly, so why prevent the user having a column called "oid"?

only the physical tables
> themselves...
>
> > > "D'Arcy J.M. Cain" wrote:
> > >
> > > Thus spake Chris Bitmead
> > > > It would be much better if you could have an oid column in a view if you
> > > > want. Like
> > > > CREATE VIEW productv AS SELECT oid, * FROM product;
> > > >
> > > > But that's not allowed. Any reason why?
> > >
> > > Because the oid is not included in the view. Consider the following.
> > >
> > > CREATE VIEW c AS SELECT a1, a2, b1, b2 FROM a, b WHERE a_key = b_key;
> > >
> > > So which oid do you want, the one from table a or the one from table b?
> > > You can, however, do this.
> > >
> > > CREATE VIEW c AS SELECT a.oid AS a_oid, b.oid AS b_oid, a1, a2, b1, b2
> > > FROM a, b WHERE a_key = b_key;
> > >
> > > --
> > > D'Arcy J.M. Cain <darcy(at){druid|vex}.net> | Democracy is three wolves
> > > http://www.druid.net/darcy/ | and a sheep voting on
> > > +1 416 424 2871 (DoD#0082) (eNTP) | what's for dinner.
> >
> > --
> > Chris Bitmead
> > http://www.bigfoot.com/~chris.bitmead
> > mailto:chris(dot)bitmead(at)bigfoot(dot)com
> >
>
> Marc G. Fournier ICQ#7615664 IRC Nick: Scrappy
> Systems Administrator @ hub.org
> primary: scrappy(at)hub(dot)org secondary: scrappy(at){freebsd|postgresql}.org

--
Chris Bitmead
http://www.bigfoot.com/~chris.bitmead
mailto:chris(dot)bitmead(at)bigfoot(dot)com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Chris Bitmead 1999-04-27 10:18:00 Re: [HACKERS] It would be nice if this could be fixed...
Previous Message Jan Wieck 1999-04-27 10:05:49 Re: [HACKERS] numeric data type on 6.5