Hi
I was wondering whether there is anyway to use unique values in views.
If I create a view it drops all unique definitions. Is it possible
to reference a view with a foreign key?
for example:
>test=# CREATE TABLE ex1 (c1 int PRIMARY KEY);
>NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'ex1_pkey'
>for table 'ex1'
>CREATE
>test=# CREATE TABLE ex2 (c2 int,col char[4]);
>CREATE
>test=# CREATE VIEW v AS SELECT * FROM ex1, ex2 WHERE c1=c2;
>CREATE
>test=# \d v
> View "v"
> Attribute | Type | Modifier
>-----------+----------------+----------
> c1 | integer |
> c2 | integer |
> col | character(1)[] |
>View definition: SELECT ex1.c1, ex2.c2, ex2.col FROM ex1, ex2 WHERE
>(ex1.c1 = ex2.c2);
c1 is here not unique!
- Einar Karttunen