pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #14739: Wrong message when unique contraint fail
3+ messages / 3 participants
[nested] [flat]

* BUG #14739: Wrong message when unique contraint fail
@ 2017-07-10 13:16 fbd@datasapiens.com
  2017-07-10 16:19 ` Re: BUG #14739: Wrong message when unique contraint fail David G. Johnston <david.g.johnston@gmail.com>
  2017-07-10 16:25 ` Re: BUG #14739: Wrong message when unique contraint fail Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 2 replies; 3+ messages in thread

From: fbd@datasapiens.com @ 2017-07-10 13:16 UTC (permalink / raw)
  To: pgsql-bugs; +Cc: fbd@datasapiens.com

The following bug has been logged on the website:

Bug reference:      14739
Logged by:          Fred BARROUD
Email address:      fbd@datasapiens.com
PostgreSQL version: 9.6.1
Operating system:   Windows 10
Description:        

I there,

I am testing PG on this query :

CREATE TABLE T_UNIK (ID INT UNIQUE);

INSERT INTO T_UNIK VALUES (1), (2), (3), (4), (5);

UPDATE T_UNIK SET ID = ID + 1;

I know that PG is unable to do this set based operation properly because it
does it row by row (which is a nonsense since it works on many RDBMS)

But the error message is strongly stupid :
ERROR:  invalid byte sequence for encoding "UTF8": 0xe9 0x71 0x75

I am doing this through PG Admin 4 (v 1.1)

Thanks in advance




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


^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #14739: Wrong message when unique contraint fail
  2017-07-10 13:16 BUG #14739: Wrong message when unique contraint fail fbd@datasapiens.com
@ 2017-07-10 16:19 ` David G. Johnston <david.g.johnston@gmail.com>
  1 sibling, 0 replies; 3+ messages in thread

From: David G. Johnston @ 2017-07-10 16:19 UTC (permalink / raw)
  To: fbd@datasapiens.com; +Cc: pgsql-bugs

On Mon, Jul 10, 2017 at 6:16 AM, <fbd@datasapiens.com> wrote:

> The following bug has been logged on the website:
>
> Bug reference:      14739
> Logged by:          Fred BARROUD
> Email address:      fbd@datasapiens.com
> PostgreSQL version: 9.6.1
> Operating system:   Windows 10
> Description:
>
> ​[...]
​


> UPDATE T_UNIK SET ID = ID + 1;
>
> I know that PG is unable to do this set based operation properly because it
> does it row by row (which is a nonsense since it works on many RDBMS)
>

​If you setup deferred constraints and execute in a matching transaction
mode the above will work just fine.  For performance reasons it just
doesn't work by default.​


> But the error message is strongly stupid :
> ERROR:  invalid byte sequence for encoding "UTF8": 0xe9 0x71 0x75
>
> I am doing this through PG Admin 4 (v 1.1)


​Performing that in psql on 9.6.3 provokes the expected error message so
either its a 9.6.1 problem (doubtful) and you should upgrade or its a
pgAdmin 4 problem (not that doubtful unfortunately) and you should report
it on their mailing lists.  This list is intended for bugs in the server
and the psql client.  pgAdmin is a third-party project.

David J.

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #14739: Wrong message when unique contraint fail
  2017-07-10 13:16 BUG #14739: Wrong message when unique contraint fail fbd@datasapiens.com
@ 2017-07-10 16:25 ` Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 0 replies; 3+ messages in thread

From: Tom Lane @ 2017-07-10 16:25 UTC (permalink / raw)
  To: fbd@datasapiens.com; +Cc: pgsql-bugs

fbd@datasapiens.com writes:
> I am testing PG on this query :
> CREATE TABLE T_UNIK (ID INT UNIQUE);
> INSERT INTO T_UNIK VALUES (1), (2), (3), (4), (5);
> UPDATE T_UNIK SET ID = ID + 1;

> I know that PG is unable to do this set based operation properly because it
> does it row by row (which is a nonsense since it works on many RDBMS)

The solution for that is documented: declare the unique constraint as
deferrable.

regression=# CREATE TABLE T_UNIK (ID INT UNIQUE deferrable );
CREATE TABLE
regression=# INSERT INTO T_UNIK VALUES (1), (2), (3), (4), (5);
INSERT 0 5
regression=# UPDATE T_UNIK SET ID = ID + 1;
UPDATE 5

> But the error message is strongly stupid :
> ERROR:  invalid byte sequence for encoding "UTF8": 0xe9 0x71 0x75

I don't get that here.  It looks like you must be typing some non-ASCII
characters and not everything is on the same page about what encoding
they are in.

			regards, tom lane


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



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2017-07-10 16:25 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-07-10 13:16 BUG #14739: Wrong message when unique contraint fail fbd@datasapiens.com
2017-07-10 16:19 ` David G. Johnston <david.g.johnston@gmail.com>
2017-07-10 16:25 ` Tom Lane <tgl@sss.pgh.pa.us>

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