Re: [GENERAL] foreign key with char and varchar

2017-08-10 Thread Tom Lane
Thomas Poty writes: > I wanted to test if char and varchar can be cross-referenced as foreign > key. So i did these tests : > ... > I thought the columns referring and referenced had to be the same data type > with the same length but it seems not to be the case. Looking into the code, I see that

[GENERAL] foreign key with char and varchar

2017-08-10 Thread Thomas Poty
Hi world, I wanted to test if char and varchar can be cross-referenced as foreign key. So i did these tests : 1) Can a varchar(7) reference a char(2) ? PostgreSQL accepts it create table t1 (id char(2) primary key, data text); create table t2 (id char(2) primary key, data text, id_t1 varchar(7) r