Skip site navigation (1) Skip section navigation (2)

Re: [HACKERS] A small type extension example for the contrib directory (fwd)

From: Tom I Helbekkmo <tih(at)Hamartun(dot)Priv(dot)NO>
To: The Hermit Hacker <scrappy(at)hub(dot)org>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] A small type extension example for the contrib directory (fwd)
Date: 1998-01-25 09:20:49
Message-ID: 980125093705.12666A@barsoom.Hamartun.Priv.NO (view raw or flat)
Thread:
Lists: pgsql-hackers
On Sun, 25 Jan 1998, The Hermit Hacker wrote:

> 	I added this to the contrib directory for the server,  but am
> wondering if anyone feels that this just might be useful as a "normal"
> datatype, instead of just in the contrib directory...

I, naturally, like the idea.  :-)  However, there are problems with
the code I submitted -- as I said, it's my first shot at this:

- since then, I've learned (hi, Bruce!) that commutativity is not what
I thought it was, and that LIKE is not only not commutative, it's not
even reflexive.

- the Makefile is BSD-specific, and I don't know how to avoid this.

- my LIKE operator for IP addresses fails.  I've written about this to
the questions list, and I'm more and more certain that this has to be
a bug in PostgreSQL.  (Yes, that's arrogant of me, but I can't for the
life of me see any other possibility.  If someone could look at it
(there's a sample "test.sql" that shows the problem, and I've left the
debug output in the C source), that would be great!)

- I'm using 8 bytes of storage for each type, while I probably could
get away with 5 for IP addresses and 6 for ethernet addresses.  I just
didn't know for sure what the alignment aspects and so on were, and I
had the disk space to spare, so I never experimented to find out.

With all that said, I still think that this is both a useful data type
extension and a neat, small example of how to do this.  If it is to be
used as a base for creating a new internal data type, though, it must
be looked at carefully by someone else; I am only an egg.

I'd also like to be able to index on IP addresses, but the amount of
hair needed to add this seems to be somewhat larger than what I have.
If someone wants to show me how to extend my code to allow this, I would
very much appreciate it.

I'm attaching an updated version of the sample files.  Most of the
occurrences of "commutator = ..." are gone now, and there is a note in
the README to the effect that LIKE and NOT LIKE do not work.

-tih
-- 
Popularity is the hallmark of mediocrity.  --Niles Crane, "Frasier"

Attachment: ip+mac.tar.gz
Description: application/octet-stream (6.1 KB)

In response to

pgsql-hackers by date

Next:From: Peter T MountDate: 1998-01-25 10:51:20
Subject: Re: [HACKERS] A small type extension example for the contrib directory (fwd)
Previous:From: The Hermit HackerDate: 1998-01-25 07:12:09
Subject: A small type extension example for the contrib directory (fwd)

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group