public inbox for [email protected]  
help / color / mirror / Atom feed
Outdated note about unique indexes
3+ messages / 3 participants
[nested] [flat]

* Outdated note about unique indexes
@ 2015-07-08 21:56 Josh Kupershmidt <[email protected]>
  2015-07-08 22:10 ` Re: Outdated note about unique indexes Josh Berkus <[email protected]>
  0 siblings, 1 reply; 3+ messages in thread

From: Josh Kupershmidt @ 2015-07-08 21:56 UTC (permalink / raw)
  To: pgsql-docs

Hi,

I noticed that the note on a page about unique indexes

http://www.postgresql.org/docs/current/static/indexes-unique.html

says "The preferred way to add a unique constraint to a table is ALTER
TABLE ... ADD CONSTRAINT. The use of indexes to enforce unique constraints
could be considered an implementation detail that should not be accessed
directly... ".

That note has been there forever, in particular since before we supported
CONCURRENTLY, which is pretty darn important in many uses nowadays. Since
it seems like some users have taken this suggestion seriously, e.g. on
stackoverflow[1], how about we remove this outdated suggestion? There is
already a previous mention a few sections earlier[2] suggesting the use of
CONCURRENTLY, so I don't think we really need to reiterate that suggestion
here.

Josh

[1]
http://stackoverflow.com/questions/23542794/postgres-unique-constraint-vs-index
[2] http://www.postgresql.org/docs/current/interactive/indexes-intro.html

diff --git a/doc/src/sgml/indices.sgml b/doc/src/sgml/indices.sgml
index 309fd12..2d131c9 100644
--- a/doc/src/sgml/indices.sgml
+++ b/doc/src/sgml/indices.sgml
@@ -655,11 +655,7 @@ CREATE UNIQUE INDEX <replaceable>name</replaceable> ON <replaceable>table</repla
 
   <note>
    <para>
-    The preferred way to add a unique constraint to a table is
-    <literal>ALTER TABLE ... ADD CONSTRAINT</literal>.  The use of
-    indexes to enforce unique constraints could be considered an
-    implementation detail that should not be accessed directly.
-    One should, however, be aware that there's no need to manually
+    There's no need to manually
     create indexes on unique columns; doing so would just duplicate
     the automatically-created index.
    </para>


-- 
Sent via pgsql-docs mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs


Attachments:

  [text/plain] indices_constraint_suggestion.diff (769B, 3-indices_constraint_suggestion.diff)
  download | inline diff:
diff --git a/doc/src/sgml/indices.sgml b/doc/src/sgml/indices.sgml
index 309fd12..2d131c9 100644
--- a/doc/src/sgml/indices.sgml
+++ b/doc/src/sgml/indices.sgml
@@ -655,11 +655,7 @@ CREATE UNIQUE INDEX <replaceable>name</replaceable> ON <replaceable>table</repla
 
   <note>
    <para>
-    The preferred way to add a unique constraint to a table is
-    <literal>ALTER TABLE ... ADD CONSTRAINT</literal>.  The use of
-    indexes to enforce unique constraints could be considered an
-    implementation detail that should not be accessed directly.
-    One should, however, be aware that there's no need to manually
+    There's no need to manually
     create indexes on unique columns; doing so would just duplicate
     the automatically-created index.
    </para>


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

* Re: Outdated note about unique indexes
  2015-07-08 21:56 Outdated note about unique indexes Josh Kupershmidt <[email protected]>
@ 2015-07-08 22:10 ` Josh Berkus <[email protected]>
  2015-08-31 21:05   ` Re: Outdated note about unique indexes Bruce Momjian <[email protected]>
  0 siblings, 1 reply; 3+ messages in thread

From: Josh Berkus @ 2015-07-08 22:10 UTC (permalink / raw)
  To: pgsql-docs


> That note has been there forever, in particular since before we
> supported CONCURRENTLY, which is pretty darn important in many uses
> nowadays. Since it seems like some users have taken this suggestion
> seriously, e.g. on stackoverflow[1], how about we remove this outdated
> suggestion? There is already a previous mention a few sections
> earlier[2] suggesting the use of CONCURRENTLY, so I don't think we
> really need to reiterate that suggestion here.

+1


-- 
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com


-- 
Sent via pgsql-docs mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs



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

* Re: Outdated note about unique indexes
  2015-07-08 21:56 Outdated note about unique indexes Josh Kupershmidt <[email protected]>
  2015-07-08 22:10 ` Re: Outdated note about unique indexes Josh Berkus <[email protected]>
@ 2015-08-31 21:05   ` Bruce Momjian <[email protected]>
  0 siblings, 0 replies; 3+ messages in thread

From: Bruce Momjian @ 2015-08-31 21:05 UTC (permalink / raw)
  To: Josh Berkus <[email protected]>; +Cc: pgsql-docs

On Wed, Jul  8, 2015 at 03:10:46PM -0700, Josh Berkus wrote:
> 
> > That note has been there forever, in particular since before we
> > supported CONCURRENTLY, which is pretty darn important in many uses
> > nowadays. Since it seems like some users have taken this suggestion
> > seriously, e.g. on stackoverflow[1], how about we remove this outdated
> > suggestion? There is already a previous mention a few sections
> > earlier[2] suggesting the use of CONCURRENTLY, so I don't think we
> > really need to reiterate that suggestion here.
> 
> +1

Patch applied through 9.5.

-- 
  Bruce Momjian  <[email protected]>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + Everyone has their own god. +


-- 
Sent via pgsql-docs mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs




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


end of thread, other threads:[~2015-08-31 21:05 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-07-08 21:56 Outdated note about unique indexes Josh Kupershmidt <[email protected]>
2015-07-08 22:10 ` Josh Berkus <[email protected]>
2015-08-31 21:05   ` Bruce Momjian <[email protected]>

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