சிவகுமார் மா wrote:
> CREATE TABLE test (info_type varchar(3), info_reference integer);
> (depending on info_type, info_reference will contain key values from
> different tables)
>
> INSERT INTO test (info_type, info_reference) values ('abc','111'); ---
> 111 from tableA
> INSERT INTO test (info_t
On Thu, Nov 15, 2007 at 07:46:46PM +0530, ??? ??
wrote:
> On Nov 15, 2007 5:52 PM, Sam Mason <[EMAIL PROTECTED]> wrote:
> > What I tend to do here, is something like:
> >
> > CREATE TABLE test (
> > type INTEGER,
> > ref1 INTEGER REFERENCES table1 CHECK ((typ
சிவகுமார் மா wrote:
>> You want to have a "conditional" foreign key reference that checks
>> against different tables depending on a "type" field, right?
>>
>> For complicated conditions like this, you could use a
>> BEFORE INSERT trigger that throws an error when the condition
>> is violated.
>
>
On Nov 15, 2007 5:52 PM, Sam Mason <[EMAIL PROTECTED]> wrote:
> What I tend to do here, is something like:
>
> CREATE TABLE test (
> type INTEGER,
> ref1 INTEGER REFERENCES table1 CHECK ((type = 1) = (ref1 IS NOT NULL)),
> ref2 INTEGER REFERENCES table2 CHECK ((type = 2) = (ref2 IS N
On Nov 15, 2007 7:32 PM, Albe Laurenz <[EMAIL PROTECTED]> wrote:
>
> You want to have a "conditional" foreign key reference that checks
> against different tables depending on a "type" field, right?
>
> For complicated conditions like this, you could use a
> BEFORE INSERT trigger that throws an err
On Thu, Nov 15, 2007 at 01:24:04PM +0530, ??? ??
wrote:
> Is there a way to force join conditions in queries i.e. When a join is
> made to a table on a particular field, another column should also be
> checked?
>
> CREATE TABLE test (info_type varchar(3), info_referenc
On Nov 15, 2007 8:17 PM, Sam Mason <[EMAIL PROTECTED]> wrote:
> As Albe suggested, a view is about all that's going to help the poor
> people who work with this. When I do this sort of thing, I tend to
> find that there are very few queries that actually need everything all
> together in one place
Is there a way to force join conditions in queries i.e. When a join is
made to a table on a particular field, another column should also be
checked?
CREATE TABLE test (info_type varchar(3), info_reference integer);
(depending on info_type, info_reference will contain key values from
different tabl