serial type as foreign key referential integrity violation
В списке pgsql-hackers по дате отправления:
| От | leozc@cse.unsw.edu.au (Zhicong Leo Liang) |
|---|---|
| Тема | serial type as foreign key referential integrity violation |
| Дата | |
| Msg-id | f1f5c8c3.0208310428.93db45b@posting.google.com обсуждение |
| Ответы |
Re: serial type as foreign key referential integrity violation
Re: serial type as foreign key referential integrity |
| Список | pgsql-hackers |
Hi all, Just briefly describe my problem. I have two tables.
create table A( a1 serial primary key, a2 varchars(10)
);
create table B( b1 integer primary key, b2 Integer, foreign key(b2) references a(a1)
)
insert into A values('123');
select a1 from A where a2='123'
>--
>a1
>--
>1
>--
insert into B values (1,1);
ERROR!! referential integrity violation - key referenced from B not found in A.
but in table A , if I change it the PK to integer, everything would be fine.
any idea?
thanks a lot!
В списке pgsql-hackers по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера