pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
setting foreigh key for an array.
3+ messages / 2 participants
[nested] [flat]

* setting foreigh key for an array.
@ 2011-02-14 10:56 dba <dbadbb@gmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: dba @ 2011-02-14 10:56 UTC (permalink / raw)
  To: pgsql-admin





I have a requirement.

Created table called a.
CREATE TABLE a(no int primary key,name text);


Need to create reference key for no field of array. which is belongs to b
table.
The postgresql is not allowing to create a reference for incompatible type.

CREATE TABLE d(no int[] references a,name text);
ERROR:  foreign key constraint "d_no_fkey" cannot be implemented
DETAIL:  Key columns "no" and "no" are of incompatible types: integer[] and
integer.

Is there any solution to setting foreign key for an array.

NOTE:
        Kindly ensure that I don't want to change the int to int[] in a
table. 

-- 
View this message in context: http://postgresql.1045698.n5.nabble.com/setting-foreigh-key-for-an-array-tp3384263p3384263.html
Sent from the PostgreSQL - admin mailing list archive at Nabble.com.



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* setting foreigh key for an array.
@ 2011-02-14 10:56 dba <dbadbb@gmail.com>
  2011-02-14 16:17 ` Re: setting foreigh key for an array. pasman pasmański <pasman.p@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: dba @ 2011-02-14 10:56 UTC (permalink / raw)
  To: pgsql-admin





I have a requirement.

Created table called a.
CREATE TABLE a(no int primary key,name text);


Need to create reference key for no field of array. which is belongs to b
table.
The postgresql is not allowing to create a reference for incompatible type.

CREATE TABLE d(no int[] references a,name text);
ERROR:  foreign key constraint "d_no_fkey" cannot be implemented
DETAIL:  Key columns "no" and "no" are of incompatible types: integer[] and
integer.

Is there any solution to setting foreign key for an array.

NOTE:
        Kindly ensure that I don't want to change the int to int[] in a
table. 

-- 
View this message in context: http://postgresql.1045698.n5.nabble.com/setting-foreigh-key-for-an-array-tp3384264p3384264.html
Sent from the PostgreSQL - admin mailing list archive at Nabble.com.



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: setting foreigh key for an array.
  2011-02-14 10:56 setting foreigh key for an array. dba <dbadbb@gmail.com>
@ 2011-02-14 16:17 ` pasman pasmański <pasman.p@gmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: pasman pasmański @ 2011-02-14 16:17 UTC (permalink / raw)
  To: dba <dbadbb@gmail.com>; pgsql-admin

You write trigger for integrity

-- 
------------
pasman



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2011-02-14 16:17 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-02-14 10:56 setting foreigh key for an array. dba <dbadbb@gmail.com>
2011-02-14 10:56 setting foreigh key for an array. dba <dbadbb@gmail.com>
2011-02-14 16:17 ` pasman pasmański <pasman.p@gmail.com>

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