pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Unsigned numbers
4+ messages / 3 participants
[nested] [flat]

* Unsigned numbers
@ 2003-11-25 11:11 Kaloyan Iliev Iliev <kaloyan@faith.digsys.bg>
  0 siblings, 0 replies; 4+ messages in thread

From: Kaloyan Iliev Iliev @ 2003-11-25 11:11 UTC (permalink / raw)
  To: pgsql-sql

Hello Friends,

I have the following questions.
I have a lot of fields in my database that are int or float.
The problem is that I need them to be only positive (unsigned) and the 
users try to insert sometimes negative.
I know that I can make this with CHECK CONSTRAINT but for some reasons 
this is not a good solution for me. The reason is that when I have a 
check constraint on a certain field and someone try to insert negative 
number the error message contains the name of the constraint and the 
name of the table but not the name of the field. So on higher level I 
can't send a proper message to the user.

Are there any unsigned data types like unsigned int or unsigned float.
Can I make a domain or something like that (How exactly to add 
constraint to domain).
I am using v7.3.2.
Thanks!




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Unsigned numbers
@ 2003-11-26 11:10 Kaloyan Iliev Iliev <news1@faith.digsys.bg>
  2003-11-26 11:46 ` Re: Unsigned numbers Richard Huxton <dev@archonet.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Kaloyan Iliev Iliev @ 2003-11-26 11:10 UTC (permalink / raw)
  To: pgsql-sql

Hello Friends,

I have the following questions.
I have a lot of fields in my database that are int or float.
The problem is that I need them to be only positive (unsigned) and the 
users try to insert sometimes negative.
I know that I can make this with CHECK CONSTRAINT but for some reasons 
this is not a good solution for me. The reason is that when I have a 
check constraint on a certain field and someone try to insert negative 
number the error message contains the name of the constraint and the 
name of the table but not the name of the field. So on higher level I 
can't send a proper message to the user.

Are there any unsigned data types like unsigned int or unsigned float.
Can I make a domain or something like that (How exactly to add 
constraint to domain).
I am using v7.3.2.
Thanks!




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Unsigned numbers
  2003-11-26 11:10 Unsigned numbers Kaloyan Iliev Iliev <news1@faith.digsys.bg>
@ 2003-11-26 11:46 ` Richard Huxton <dev@archonet.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Richard Huxton @ 2003-11-26 11:46 UTC (permalink / raw)
  To: Kaloyan Iliev Iliev <news1@faith.digsys.bg>; pgsql-sql

On Wednesday 26 November 2003 11:10, Kaloyan Iliev Iliev wrote:
> Hello Friends,
>
> I have the following questions.
> I have a lot of fields in my database that are int or float.
> The problem is that I need them to be only positive (unsigned) and the
> users try to insert sometimes negative.
[snip - problem is that errors give constraint name]

> Are there any unsigned data types like unsigned int or unsigned float.
> Can I make a domain or something like that (How exactly to add
> constraint to domain).
> I am using v7.3.2.

Adding CHECKs to domains is new for 7.4, I believe. There aren't any built-in 
unsigned types, although in theory you could write your own.

What I do is format my constraint names in a known way. So, a check on table 
foo, column bar might be called "foo_bar_positive" - then I can get the 
information I want from the constraint name.

-- 
  Richard Huxton
  Archonet Ltd



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Unsigned numbers
@ 2003-11-27 08:01 Kaloyan Iliev Iliev <news1@faith.digsys.bg>
  0 siblings, 0 replies; 4+ messages in thread

From: Kaloyan Iliev Iliev @ 2003-11-27 08:01 UTC (permalink / raw)
  To: pgsql-sql


10x you all





^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2003-11-27 08:01 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-11-25 11:11 Unsigned numbers Kaloyan Iliev Iliev <kaloyan@faith.digsys.bg>
2003-11-26 11:10 Unsigned numbers Kaloyan Iliev Iliev <news1@faith.digsys.bg>
2003-11-26 11:46 ` Richard Huxton <dev@archonet.com>
2003-11-27 08:01 Unsigned numbers Kaloyan Iliev Iliev <news1@faith.digsys.bg>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox