Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 7F1C66500B4 for ; Wed, 30 Jul 2008 18:29:54 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 54794-05 for ; Wed, 30 Jul 2008 18:29:47 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 06F1364FFE4 for ; Wed, 30 Jul 2008 18:29:50 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id m6ULTmsH023743; Wed, 30 Jul 2008 17:29:48 -0400 (EDT) To: Gregory Stark cc: pgsql-hackers@postgreSQL.org Subject: Re: Should creating a new base type require superuser status? In-reply-to: <87sktrgjdj.fsf@oxford.xeocode.com> References: <19715.1217447413@sss.pgh.pa.us> <87sktrgjdj.fsf@oxford.xeocode.com> Comments: In-reply-to Gregory Stark message dated "Wed, 30 Jul 2008 22:19:36 +0100" Date: Wed, 30 Jul 2008 17:29:48 -0400 Message-ID: <23742.1217453388@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200807/1448 X-Sequence-Number: 121708 Gregory Stark writes: > I know when I was first starting out it was a big source of frustration that > you have to get those arguments right.. Until I figured out what they all > meant and how to use them I was constantly crashing the server. > It seems to me we should be able to do better. To have some kind of struct in > the C code associated with the input/output functions from which the create > type command picks up these parameters. And what are the odds that you'll get it right in a C struct if you couldn't get it right in the SQL command? There might be some small advantage here from a packaging standpoint, but I think the argument that it'd help novice PG hackers is bogus. > As a consequence we could perhaps aim to make creating new types safe rather > than just deal with the fact that it's not safe currently? It would be nice if > non-superusers could create types which used an existing set of input/output > functions but defined new semantics. Unless you're going to allow them to create new C functions, I'm not clear on how much they're going to be able to change the semantics. >> * The just-added ability to specify a new type's type category and >> "preferred" status could allow subverting the behavior of existing >> queries that expect ambiguous operators to be resolved in a particular >> way. A new preferred type could "capture" such queries and thereby >> provide a trojan-horse vector for executing functions as some other >> user. > Would it be enough to only require super-user to create a preferred type? Well, it'd close one hole, but I think there are too many others to take a narrow-gauge approach. regards, tom lane