Make CREATE AGGREGATE check validity of initcond value?
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-hackers@postgreSQL.org
Date: 2012-10-04T02:38:00Z
Lists: pgsql-hackers
Attachments
- create-aggregate-check-initcond.patch (text/x-patch) patch
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