Re: check (constraint) on point data type?

Поиск
Список
Период
Сортировка
От Jill
Тема Re: check (constraint) on point data type?
Дата
Msg-id BAY102-DAV101BAA95497D7807FB9600FFF10@phx.gbl
обсуждение исходный текст
Ответ на check (constraint) on point data type?  ("Jill" <jill289@hotmail.com>)
Ответы Re: check (constraint) on point data type?  (Michael Glaesemann <grzm@seespotcode.net>)
Список pgsql-novice
----- Original Message -----
From: "Michael Glaesemann" <grzm@seespotcode.net>
To: "Jim Nasby" <decibel@decibel.org>
Cc: "Jill" <jill289@hotmail.com>; <pgsql-novice@postgresql.org>
Sent: Tuesday, July 24, 2007 5:19 PM
Subject: Re: [NOVICE] check (constraint) on point data type?


> [Please don't top post as it makes the discussion more difficult to
> follow.]
>
> On Jul 24, 2007, at 16:10 , Jim Nasby wrote:
>
>> What's wrong with (NOT location <@ box '((0,0),(1,1))') ?
>
> Two reasons I didn't provide that answer:
>
> 1)
>
> On Jul 24, 2007, at 2:06 PM, Michael Glaesemann wrote:
>
>> I haven't looked at the geometric functions closely enough to see  if you
>> could use some of those rather than defining your own  helper, but this
>> should work.
>
> 2) I misread the specs and assumed that 0 and 1 values for x and y  were
> to be rejected. I suspected that the geometric functions were  inclusive
> rather than exclusive, which, upon experimentation, was  correct. Right
> answer to the wrong specs :)
>
> # select not '(0,0)'::point <@ '((0,0),(1,1))'::box;
> ?column?
> ----------
> f
> (1 row)
>
> Michael Glaesemann
> grzm seespotcode net
>
>
>

Thank you so much guys - quick, detailed, and to the point. In fact Michael
understood right what I was trying to say (i.e., I need to accept values
between 0 and 1 and reject anything else) - but Jim's suggestion is shorter
(but Michael's is useful since now I know how to write a struc for another
problem I have).
Thanks again!


В списке pgsql-novice по дате отправления:

Предыдущее
От: Michael Glaesemann
Дата:
Сообщение: Re: check (constraint) on point data type?
Следующее
От: Michael Glaesemann
Дата:
Сообщение: Re: check (constraint) on point data type?