| От | Cristóvão B. B. Dalla Costa |
|---|---|
| Тема | Re: Conditional SQL query |
| Дата | |
| Msg-id | 003f01c0477a$04717320$02ffa8c0@terrificus обсуждение исходный текст |
| Ответ на | Re: Conditional SQL query (Indraneel Majumdar <indraneel@www.cdfd.org.in>) |
| Список | pgsql-sql |
> > Now I have one more problem. How do I insert only once if value does not > exist? eg: > You should create a unique index on the appropriate fields. For example: CREATE UNIQUE INDEX indexname ON table (field1, field2) Then the insert will fail if this particular combination of the values of (field1, field2) is already in the table. Be careful if the insert is inside a transaction, tough. If it fails due to non-uniqueness your transaction will be aborted (all further queries ignored untill a COMMIT or ROLLBACK).
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера