pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: juniorperezpy@gmail.com
To: pgsql-bugs@postgresql.org
Subject: BUG #14209: Rules don't validate duplicated keys
Date: Wed, 22 Jun 2016 22:40:47 +0000
Message-ID: <20160622224047.5790.20517@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

The following bug has been logged on the website:

Bug reference:      14209
Logged by:          Abdel Perez
Email address:      juniorperezpy@gmail.com
PostgreSQL version: 9.5.1
Operating system:   Window 7 Professional
Description:        

I've a list with duplicates values I use like pk and I create a rule like
this:

CREATE OR REPLACE RULE db_table_ignore_duplicate_inserts AS
    ON INSERT TO products
   WHERE (EXISTS ( SELECT 1
           FROM products
          WHERE products.id = new.id AND btrim(products.description::text) =
btrim(new.description::text))) DO INSTEAD NOTHING;

when I insert individually the rule works and its says me he ignores the
duplicate row, but when insert this way:

insert into products (id, description) values (1, 'product1'), (1,
'producto1);

he inserts anyway the two rows.

I didn't see in the documentation that the rule must ignore this cases.


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs


view thread (2+ messages)  latest in thread

Message-ID: <20160622224047.5790.20517@wrigleys.postgresql.org>
Permalink:  ../20160622224047.5790.20517@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/20160622224047.5790.20517@wrigleys.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: juniorperezpy@gmail.com
  Subject: Re: BUG #14209: Rules don't validate duplicated keys
  In-Reply-To: <20160622224047.5790.20517@wrigleys.postgresql.org>
  References: <20160622224047.5790.20517@wrigleys.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox