Make CREATE AGGREGATE check validity of initcond value?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: Make CREATE AGGREGATE check validity of initcond value?
Date: 2012-10-04 02:38:00
Message-ID: 13247.1349318280@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

In http://archives.postgresql.org/pgsql-general/2012-10/msg00138.php
we see an example where a user tried to create an aggregate whose
"initcond" (initial transition value) wasn't valid for the transition
data type. CREATE AGGREGATE didn't complain because it just stores the
initial condition as a text string. It seems to me that it'd be a lot
more user-friendly if it did check the value, as per the attached
proposed patch.

Does anyone have an objection to this? I can imagine cases where the
check would reject values that would get accepted at runtime, if the
type's input function was sensitive to the phase of the moon or
something. But it doesn't seem very probable, whereas checking the
value seems like an eminently useful thing to do. Or maybe I'm just
overreacting to the report --- I can't recall any previous complaints
like this, so maybe entering a bogus initcond is a corner case too.

regards, tom lane

Attachment Content-Type Size
create-aggregate-check-initcond.patch text/x-patch 1.9 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2012-10-04 02:51:29 Re: Support for REINDEX CONCURRENTLY
Previous Message Greg Stark 2012-10-04 02:31:45 Re: Support for REINDEX CONCURRENTLY