On Conflict Do nothing errors IF conflict and there is a data type length or check failure

Поиск
Список
Период
Сортировка
От Regina Obe
Тема On Conflict Do nothing errors IF conflict and there is a data type length or check failure
Дата
Msg-id 000e01d16944$dd519920$97f4cb60$@pcorp.us
обсуждение исходный текст
Ответы Re: On Conflict Do nothing errors IF conflict and there is a data type length or check failure  (Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>)
Список pgsql-hackers
I'm guessing this is by design but just wanted to confirm that since it
makes this feature not as useful for us.  

It also wasn't absolutely clear to me from the documentation.

We are running PostgreSQL 9.5.1 and if we do something like:

CREATE TABLE test(field1 varchar(5) primary key, field2 varchar(3));

INSERT INTO test(field1, field2) VALUES ('test','tes');

INSERT INTO test(field1,field2) VALUES('test', 'test')
ON CONFLICT(field1) DO NOTHING;

It triggers an error:

ERROR:  value too long for type character varying(3)

I think it does this for check constraints too.


Even though the record under consideration would be thrown out anyway.


Thanks,
Regina








В списке pgsql-hackers по дате отправления:

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Fix handling of invalid sockets returned by PQsocket()
Следующее
От: Tatsuo Ishii
Дата:
Сообщение: Re: Figures in docs