Re: macaddr data type issue

From: Justin Clift <justin(at)postgresql(dot)org>
To: Gayland Gump <gumpg(at)pacifier(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: macaddr data type issue
Date: 2001-08-21 17:16:51
Message-ID: 3B829783.5A764E5D@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Gayland,

What you're attempting to insert is being interpreted as the NULL value
:

techdocs=> create table foo (bar macaddr);
CREATE
testdb=> insert into foo values ('00:00:00:00:00:00');
INSERT 75485253 1
testdb=> insert into foo values ('00:00:00:00:00:01');
INSERT 75485256 1
testdb=> insert into foo values ('000000-000000');
INSERT 75485258 1
testdb=> insert into foo values ('000000-000001');
INSERT 75485261 1
testdb=> insert into foo values (NULL);
INSERT 75485269 1
testdb=> select * from foo;
bar
-------------------

00:00:00:00:00:01

00:00:00:00:00:01

(5 rows)

testdb=>

You can probably use the NULL values (or your 000000-000000 value) as a
placeholder/"missing data" marker.

Does this help?

:-)

Regards and best wishes,

Justin Clift

Gayland Gump wrote:
>
> Hi,
>
> I am looking for some confirmation and perhaps some explanation of and for
> the following observation. If I use "000000-000000" as input to a
> macaddr data type element in my database no value appears to be stored. I
> was intending to use this value as a "missing data" marker in my
> application. I've looked for documentation high and low but haven't been
> able to find anything regarding this behavior. I did stumble upon some
> source code, which I believe is relevant, which suggests that the code's
> author was planning for a "missing value's" value. Unfortunately, the
> macaddr data type output function does not seem to produce the
> "00:00:00:00:00:00" string that I would expect.
>
> It seems to me that if I were to input and the database would accept
> "000000-000000" as indicative of missing values that the database should
> output such a value when it is encountered in a dataset. At very least,
> it would seem that some additional documentation might be warranted. I
> suspect I am missing something here. Can anyone offer confirmation of
> this behavior and an explanation for, what seems to me to be, this
> counter-intuitive behavior?
>
> Thanks for your time and effort on my behalf.
>
> Gayland
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html

--
"My grandfather once told me that there are two kinds of people: those
who work and those who take the credit. He told me to try to be in the
first group; there was less competition there."
- Indira Gandhi

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Brent R. Matzelle 2001-08-21 17:56:05 Re: New RPMS ?
Previous Message Albert REINER 2001-08-21 16:23:16 Re: How to execute a system file in procedure?