Can someone comment on this?  Why doesn't OID work in foreign keys. 
Seems this is a bug.

> First off I want to say thank your for creating a sorely needed reference and
> sharing it with the online world via the PDF document.
> 
> I do have one minor complaint though.  I'm learning Postgres from your book
> although I'm familiar with the basics of SQL.   I was at first excited then
> discouraged by the OID section of your book.  I think a much needed
> addition to the OID limitations section is that the OID field can not be
> referenced in a foreign key.  IE
> 
> CREATE TABLE t1( i INTEGER);
> CREATE TABLE t2( id OID REFERENCES t1(oid));//dose not work
> 
> You use the OID is a foreign key of sorts in the example, but you never qualify
> that using the foreign key constraint system in Postgres will not allow you to
> automate this.  I realize the OID section comes long before the constraints
> chapter, but a quick qualification would still make things clearer. Without
> the ability to use the OID field as a reference for foreign keys, it's
> usefulness is very limited.
> 
> Keep up the good work, I can't wait to buy the finished product!
> 
> _________________________
> Richard Rowell
> rrowell@shreve.net
> 
> Perl is the unix world's equivalent of VB - and just as much of an abomination.
> 


-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Tue, 4 Jul 2000 09:56:51 -0400 (EDT)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: PDF book July 2, 2000 version
Bruce Momjian wrote:
> Can someone comment on this?  Why doesn't OID work in foreign keys.
> Seems this is a bug.

    The  RI  triggers check for attribute existance by looking up
    in the relations descriptor via SPI_fnumber(). Since OID is a
    system  attribute,  it returns SPI_ERROR_NOATTRIBUTE and that
    causes the error.

    Later on, I'm not  sure  that  it  is  possible  to  use  SPI
    functions to obtain the OID of a given trigger tuple. So it'd
    be a little more to fix it.


Jan

>
> > First off I want to say thank your for creating a sorely needed reference and
> > sharing it with the online world via the PDF document.
> >
> > I do have one minor complaint though.  I'm learning Postgres from your book
> > although I'm familiar with the basics of SQL.   I was at first excited then
> > discouraged by the OID section of your book.  I think a much needed
> > addition to the OID limitations section is that the OID field can not be
> > referenced in a foreign key.  IE
> >
> > CREATE TABLE t1( i INTEGER);
> > CREATE TABLE t2( id OID REFERENCES t1(oid));//dose not work
> >
> > You use the OID is a foreign key of sorts in the example, but you never qualify
> > that using the foreign key constraint system in Postgres will not allow you to
> > automate this.  I realize the OID section comes long before the constraints
> > chapter, but a quick qualification would still make things clearer. Without
> > the ability to use the OID field as a reference for foreign keys, it's
> > usefulness is very limited.
> >
> > Keep up the good work, I can't wait to buy the finished product!
> >
> > _________________________
> > Richard Rowell
> > rrowell@shreve.net
> >
> > Perl is the unix world's equivalent of VB - and just as much of an abomination.
> >
>
>
> --
>   Bruce Momjian                        |  http://www.op.net/~candle
>   pgman@candle.pha.pa.us               |  (610) 853-3000
>   +  If your life is a hard drive,     |  830 Blythe Avenue
>   +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
>


--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck@Yahoo.com #



Tue, 4 Jul 2000 17:08:35 +0200 (MEST)
JanWieck@t-online.de (Jan Wieck)
Re: Re: PDF book July 2, 2000 version
Added to TODO:

	* Allow oid to act as a foreign key


> Bruce Momjian wrote:
> > Can someone comment on this?  Why doesn't OID work in foreign keys.
> > Seems this is a bug.
> 
>     The  RI  triggers check for attribute existance by looking up
>     in the relations descriptor via SPI_fnumber(). Since OID is a
>     system  attribute,  it returns SPI_ERROR_NOATTRIBUTE and that
>     causes the error.
> 
>     Later on, I'm not  sure  that  it  is  possible  to  use  SPI
>     functions to obtain the OID of a given trigger tuple. So it'd
>     be a little more to fix it.
> 
> 
> Jan
> 
> >
> > > First off I want to say thank your for creating a sorely needed reference and
> > > sharing it with the online world via the PDF document.
> > >
> > > I do have one minor complaint though.  I'm learning Postgres from your book
> > > although I'm familiar with the basics of SQL.   I was at first excited then
> > > discouraged by the OID section of your book.  I think a much needed
> > > addition to the OID limitations section is that the OID field can not be
> > > referenced in a foreign key.  IE
> > >
> > > CREATE TABLE t1( i INTEGER);
> > > CREATE TABLE t2( id OID REFERENCES t1(oid));//dose not work
> > >
> > > You use the OID is a foreign key of sorts in the example, but you never qualify
> > > that using the foreign key constraint system in Postgres will not allow you to
> > > automate this.  I realize the OID section comes long before the constraints
> > > chapter, but a quick qualification would still make things clearer. Without
> > > the ability to use the OID field as a reference for foreign keys, it's
> > > usefulness is very limited.
> > >
> > > Keep up the good work, I can't wait to buy the finished product!
> > >
> > > _________________________
> > > Richard Rowell
> > > rrowell@shreve.net
> > >
> > > Perl is the unix world's equivalent of VB - and just as much of an abomination.
> > >
> >
> >
> > --
> >   Bruce Momjian                        |  http://www.op.net/~candle
> >   pgman@candle.pha.pa.us               |  (610) 853-3000
> >   +  If your life is a hard drive,     |  830 Blythe Avenue
> >   +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
> >
> 
> 
> --
> 
> #======================================================================#
> # It's easier to get forgiveness for being wrong than for being right. #
> # Let's break this rule - forgive me.                                  #
> #================================================== JanWieck@Yahoo.com #
> 
> 
> 


-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Thu, 6 Jul 2000 23:23:43 -0400 (EDT)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: Re: PDF book July 2, 2000 version