pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jan Wieck <janwieck@yahoo.com>
To: Andre Schubert <andre.schubert@km3.de>
Cc: Laszlo Tibor <ltibor@mail.tiszanet.hu>
Cc: pgsql-sql@postgresql.org
Subject: Re: REFERENCES
Date: Wed, 13 Mar 2002 12:35:38 -0500 (EST)
Message-ID: <200203131735.g2DHZcO31982@saturn.janwieck.net> (raw)
In-Reply-To: <3C8F43E3.80CC03BF@km3.de>

Andre Schubert wrote:
> Laszlo Tibor schrieb:
> >
> > On Wednesday, March 13, 2002 11:53 AM Behalf Of Andre Schubert wrote:
> >
> > > Hi to all,
> > >
> > > i have a simple problem and wont request assistance fro m this list.
> > > i have to tables
> > >
> > > foo:
> > >         id int8 UNIQUE
> > >
> > > bar:
> > >         id int8 UNIQUE
> > >         foo_id int8
> > >
> > > Now i wont foo_id to be a id which exists in the foo, this could be done
> > > with foo_id REFERENCES foo (id).
> > > But what should i do if i want foo_id to be a id existing in foo or to
> > > be zero(0).
> > > I have created a view as "select id from foo UNION select 0" and tried
> > > to REFERENCE against this view, but that
> > > doesnt work.
> > > Can this problem be solved by a somebody ????
> > >
> > > Thanks
> >
> > Why do you want to use zeros? A foreign key could be NULL.
>
> Yes I know, but i need these Zeroes.....

    Put a zero into foo or don't have zeroes in bar.

    You  might  be able to work around this with custom triggers,
    but that's not the real solution. It's  clear  that  the  guy
    designing  your  data  model didn't understand the difference
    between zero and NULL.  Fix that and your problem is  solved.


Jan

--

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



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com




view thread (6+ messages)

Message-ID: <200203131735.g2DHZcO31982@saturn.janwieck.net>
Permalink:  ../200203131735.g2DHZcO31982@saturn.janwieck.net/
Also on:    postgresql.org/message-id/200203131735.g2DHZcO31982@saturn.janwieck.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: janwieck@yahoo.com, andre.schubert@km3.de, ltibor@mail.tiszanet.hu
  Subject: Re: REFERENCES
  In-Reply-To: <200203131735.g2DHZcO31982@saturn.janwieck.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox