Using CHECK while CREATE'ing table

From: vj <harikris(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Using CHECK while CREATE'ing table
Date: 2009-04-14 18:56:40
Message-ID: a640f2fe-3f74-4a2b-b65e-7023f48035cc@3g2000yqk.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi All,

I am new to postgreSQL and have a working experience with SQLite.
While i am creating a table, i want to use constraints or more so -
use checks to see that

1. the email address is valid [a basic check with no bells and
whistles is good enuf for me].
2. On a separate column entry, i would also want to check that the
string is a valid hex string i.e no characters other than [0-9 and (A-
F or a-f)] are present.

What is the simplest and most efficient way to achieve this without
having to re-invent the wheel.

Should i trigger actions during "insert" process or should i use
constraints/checks during "create" process??

TIA

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Kaarel Kitsemets 2009-04-14 19:23:41 Re: Table dependencies
Previous Message Alvaro Herrera 2009-04-14 18:53:19 Re: 'no pg_hba.conf entry for host "[local]", user "postgres", database "postgres"'...