Re: [GENERAL] Partial foreign keys

2010-02-28 Thread Tom Lane
rihad writes: > I want the effects of the above foo.key in every sense, but only for > entries having foo.flag=true. So I think I'll write before-statement > triggers to do just that instead of the key. But is data consistency > still guaranteed as the foreign key in foo would otherwise do? No

Re: [GENERAL] Partial foreign keys

2010-02-28 Thread rihad
rihad wrote: Due to lack of support for partial (conditional) multi-column foreign keys in 8.3, can before-triggers be used to implement them in terms of data consistency and speed? Let me clarify the question in semi-pseudo-SQL: table foo { bar_id int not null; baz_id int not null; fla

[GENERAL] Partial foreign keys

2010-02-27 Thread rihad
Hello, Due to lack of support for partial (conditional) multi-column foreign keys in 8.3, can before-triggers be used to implement them in terms of data consistency and speed? Thanks. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription:

Re: [GENERAL] Partial foreign keys, check constraints and inheritance

2005-11-22 Thread Jim C. Nasby
On Thu, Nov 17, 2005 at 02:21:33PM -0500, Eric E wrote: > >maybe you can solve it adding a new col and allow both to contain null > >values. > > > >if these are not mutually exclusive you can avoid a check if they are > >check that if one has a non-null value other has null... > > > I did think

Re: [GENERAL] Partial foreign keys, check constraints and inheritance

2005-11-17 Thread Greg Stark
> On 11/17/05, Eric E <[EMAIL PROTECTED]> wrote: > > > > What's the best way to do this? My immediate reaction is that I want a > > partial foreign key, but perhaps this is not a good way to go about such > > a design. Normally I just have multiple columns with all but one NULL. Alternatively

Re: [GENERAL] Partial foreign keys, check constraints and inheritance

2005-11-17 Thread Eric E
Scott Marlowe wrote: On Thu, 2005-11-17 at 13:36, Eric E wrote: Eric E wrote: maybe you can solve it adding a new col and allow both to contain null values. if these are not mutually exclusive you can avoid a check if they are check that if one has a non-null value other has null...

Re: [GENERAL] Partial foreign keys, check constraints and

2005-11-17 Thread Scott Marlowe
On Thu, 2005-11-17 at 13:36, Eric E wrote: > Eric E wrote: > > >> maybe you can solve it adding a new col and allow both to contain > >> null values. > >> > >> if these are not mutually exclusive you can avoid a check if they are > >> check that if one has a non-null value other has null... > > >

Re: [GENERAL] Partial foreign keys, check constraints and inheritance

2005-11-17 Thread Eric E
Eric E wrote: maybe you can solve it adding a new col and allow both to contain null values. if these are not mutually exclusive you can avoid a check if they are check that if one has a non-null value other has null... I did think about that, but I disliked the idea of two fields of nulls

Re: [GENERAL] Partial foreign keys, check constraints and inheritance

2005-11-17 Thread Eric E
maybe you can solve it adding a new col and allow both to contain null values. if these are not mutually exclusive you can avoid a check if they are check that if one has a non-null value other has null... I did think about that, but I disliked the idea of two fields of nulls for every one fu

Re: [GENERAL] Partial foreign keys, check constraints and inheritance

2005-11-17 Thread Jaime Casanova
On 11/17/05, Eric E <[EMAIL PROTECTED]> wrote: > Hi all, >In my database application, I've repeatedly encountered a particular > issue, and I'm not sure I'm addressing it well, so I'd like suggestions > on how to deal with it. The problem is that I need something like a > partial foreign key -

[GENERAL] Partial foreign keys, check constraints and inheritance

2005-11-17 Thread Eric E
Hi all, In my database application, I've repeatedly encountered a particular issue, and I'm not sure I'm addressing it well, so I'd like suggestions on how to deal with it. The problem is that I need something like a partial foreign key - a foreign key where, based on field1, in some rows