patch: Distinguish between unique indexes and unique constraints

Lists: pgsql-hackers
From: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: patch: Distinguish between unique indexes and unique constraints
Date: 2010-04-18 03:53:01
Message-ID: t2q4ec1cf761004172053jdd53782eo7e140a15a7890e7e@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Addressing TODO item "Distinguish between unique indexes and unique
constraints in \d+" for psql, and picking up from thread:
http://archives.postgresql.org/message-id/8780.1271187360@sss.pgh.pa.us

Attached is a simple patch which clarifies unique constraints with
"UNIQUE CONSTRAINT" in psql's \d+ description of a table. The
appearance of unique indexes is left as-is.

== Old \d+ display ==
Indexes:
"name_uniq_constr" UNIQUE, btree (name)

== New \d+ display ==
Indexes:
"name_uniq_constr" UNIQUE CONSTRAINT, btree (name)

Josh

Attachment Content-Type Size
psql_constraints.patch application/octet-stream 1.1 KB

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: patch: Distinguish between unique indexes and unique constraints
Date: 2010-04-18 15:18:11
Message-ID: g2r603c8f071004180818v7690a2fcj788db9dc5325f276@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Sat, Apr 17, 2010 at 11:53 PM, Josh Kupershmidt <schmiddy(at)gmail(dot)com> wrote:
> Addressing TODO item "Distinguish between unique indexes and unique
> constraints in \d+" for psql, and picking up from thread:
> http://archives.postgresql.org/message-id/8780.1271187360@sss.pgh.pa.us
>
> Attached is a simple patch which clarifies unique constraints with
> "UNIQUE CONSTRAINT" in psql's \d+ description of a table. The
> appearance of unique indexes is left as-is.
>
> == Old \d+ display ==
> Indexes:
>    "name_uniq_constr" UNIQUE, btree (name)
>
> == New \d+ display ==
> Indexes:
>    "name_uniq_constr" UNIQUE CONSTRAINT, btree (name)

You know, I've never really understood the difference between these
two types of things, or why we need to support both. Which may be
just because I'm slow?

...Robert


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Josh Kupershmidt <schmiddy(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: patch: Distinguish between unique indexes and unique constraints
Date: 2010-04-18 15:23:06
Message-ID: 22202.1271604186@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> You know, I've never really understood the difference between these
> two types of things, or why we need to support both. Which may be
> just because I'm slow?

Unique constraints are defined by the SQL standard, and have a syntax
that can't support a lot of the extensions that CREATE INDEX allows.
There's also restrictions in the information_schema views.
So unifying the two concepts completely would be a mess.

regards, tom lane


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Josh Kupershmidt <schmiddy(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: patch: Distinguish between unique indexes and unique constraints
Date: 2010-04-18 15:41:37
Message-ID: n2g603c8f071004180841m2c53ae89qd7d16857437009a3@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Sun, Apr 18, 2010 at 11:23 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> You know, I've never really understood the difference between these
>> two types of things, or why we need to support both.  Which may be
>> just because I'm slow?
>
> Unique constraints are defined by the SQL standard, and have a syntax
> that can't support a lot of the extensions that CREATE INDEX allows.
> There's also restrictions in the information_schema views.
> So unifying the two concepts completely would be a mess.

I thought it might be something like that.

Josh - you may want to add your patch here:

https://commitfest.postgresql.org/action/commitfest_view/open

...Robert


From: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: patch: Distinguish between unique indexes and unique constraints
Date: 2010-04-18 15:53:21
Message-ID: r2h4ec1cf761004180853y91075561v57c75d690dc5bf9e@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Sun, Apr 18, 2010 at 11:41 AM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> Josh - you may want to add your patch here:
>
> https://commitfest.postgresql.org/action/commitfest_view/open

Added, thanks!

Josh