Re: INSERT ... ON CONFLICT DO UPDATE

From: "Daniel Verite" <daniel(at)manitou-mail(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: INSERT ... ON CONFLICT DO UPDATE
Date: 2015-07-19 19:03:07
Message-ID: f6b5387a-f526-4511-8b63-506910578fc6@mm
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Melvin Davidson wrote:

> Aside from Tom Lane's comments, it seems to me you are reinventing the wheel
> by generating random values for keys. Why not just use UUID
> http://www.postgresql.org/docs/9.5/static/datatype-uuid.html
> or serial
> http://www.postgresql.org/docs/9.5/static/datatype-numeric.html#DATATYPE-SERIAL?
> Wouldn't that simplify things by insuring uniqueness?

UUIDs are 36 characters wide; it's too boring and error-prone
for a person to type this on a keyboard or spell it over the phone
to an operator.

For SERIAL, it's too obvious to guess what is the next one,
so malicious people could claim access codes or vouchers
they don't own.

The constraint is that such codes must be reasonably short, but
someone who tries to make up one must have a near-zero chance
of guessing one that actually exists.

Best regards,
--
Daniel Vérité
PostgreSQL-powered mailer: http://www.manitou-mail.org
Twitter: @ManitouMail

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joseph Kregloh 2015-07-19 20:27:56 Re: Upgrade postgres cluster on FreeBSD using pg_upgrade
Previous Message Daniel Verite 2015-07-19 18:08:45 Re: INSERT ... ON CONFLICT DO UPDATE