Re: Possible to create canonicalized range type without being superuser?

From: Paul A Jungwirth <pj(at)illuminatedcomputing(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Possible to create canonicalized range type without being superuser?
Date: 2016-07-06 05:17:06
Message-ID: CA+renyXJLzzMLfFyaTFE2w9pEUH4wD_7vXyxaQ0u=9cJsK4wRQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Jul 5, 2016 at 3:28 PM, David G. Johnston
<david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
> On Tue, Jul 5, 2016 at 5:37 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Paul Jungwirth <pj(at)illuminatedcomputing(dot)com> writes:
>> > The problem is this (tried on 9.3 and 9.5):
>>
>> The only other obvious way to deal with this is to allow the canonical
>> function to be defined after the range type is created, and then added to
>> the type via an ALTER TYPE command.
>
> Can the canonical function be definitionally optional but runtime required?

Thanks Tom and David for your help! I actually tried to find something
in ALTER TYPE that would do just that, but of course it's not there.
It seems like an appealing solution though.

With Tom's warning that a shell type would require writing the
function in C, I figured I might as well just package it all up as an
extension, so here it is:

https://github.com/pjungwir/inetrange

Of course it still requires superuser privileges, but as least the C
part is just `make && sudo make install`.

Thanks again!
Paul

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Paul A Jungwirth 2016-07-06 05:40:02 Re: Possible to create canonicalized range type without being superuser?
Previous Message Alvaro Herrera 2016-07-06 03:02:07 Re: Is it possible to use an EVENT TRIGGER to validate a TRIGGER?