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

Re: Arithmetic operators for macaddr type

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Brendan Jurd <direvus(at)gmail(dot)com>
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Arithmetic operators for macaddr type
Date: 2012-01-17 05:38:04
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
On Tue, Dec 13, 2011 at 2:16 PM, Brendan Jurd <direvus(at)gmail(dot)com> wrote:
> On 12 December 2011 15:59, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
>> 2011/12/12 Brendan Jurd <direvus(at)gmail(dot)com>:
>>> I just bumped into a situation where I wanted to do a little macaddr
>>> arithmetic in postgres.  I note that the inet type has support for
>>> bitwise AND, OR and NOT, as well as subtraction, but macaddr has none
>>> of the above.
>> +1
> Here is a patch for $SUBJECT.  I merely added support for ~, & and |
> operators for the macaddr type.  The patch itself is rather trivial,
> and includes regression tests and a doc update.

The patch looks fine except that it uses the OIDs already used in pg_proc.h.
Attached is the updated version of the patch, which fixes the above problem.

> For the documentation, I did think about adding a new table for the
> macaddr operators, but in the end decided it would probably be an
> overkill.



Fujii Masao
NTT Open Source Software Center

Attachment: macaddr-bitwise-ops_v2.diff
Description: text/x-diff (6.7 KB)

In response to


pgsql-hackers by date

Next:From: Heikki LinnakangasDate: 2012-01-17 06:21:28
Subject: Re: foreign key locks, 2nd attempt
Previous:From: Tom LaneDate: 2012-01-17 05:33:22
Subject: Re: Should we add crc32 in libpgport?

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