Home > Archive > Pgadmin > June 2005 > Add 'CHECK( length(fieldname) > 0 )' to a field









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Add 'CHECK( length(fieldname) > 0 )' to a field
Daniel Seichter

2005-06-21, 9:24 am

Hello,

I have to let postgreSQL check the length of some fields in a database.
So I want to add the SQL Code "CHECK( length(fieldname) > 0 )" to some
fields so that the check will be executed during INSERT statement.
With the properties dialog I can't add the CHECK statement, so maybe it
isn't possible or I have to take a look to something. But to what?

Thank you in advance

Daniel Seichter

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Dave Page

2005-06-21, 9:24 am



> -----Original Message-----
> From: pgadmin-support-owner@postgresql.org
> [mailto:pgadmin-support-owner@postgresql.org] On Behalf Of
> Daniel Seichter
> Sent: 21 June 2005 14:58
> To: pgadmin-support@postgresql.org
> Subject: [pgadmin-support] Add 'CHECK( length(fieldname) > 0
> )' to a field
>
> Hello,
>
> I have to let postgreSQL check the length of some fields in a
> database.
> So I want to add the SQL Code "CHECK( length(fieldname) > 0 )" to some
> fields so that the check will be executed during INSERT statement.
> With the properties dialog I can't add the CHECK statement,
> so maybe it
> isn't possible or I have to take a look to something. But to what?
>
> Thank you in advance


Hi,

You can add a new table constraint (to check one or more columns) by
right-clicking the Constraints node under the table and selecting New
Object -> New Check Constraint. I don't think any of us ever saw much
value in allowing constraints directly on individual columns as well -
it would just over-complicate the GUI for no real gain.

Regards, Dave

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com