pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <pgman@candle.pha.pa.us>
To: josh@agliodbs.com
Cc: sqllist <pgsql-sql@postgresql.org>
Subject: Re: Variable-length Types
Date: Sun, 15 Oct 2000 22:22:23 -0400 (EDT)
Message-ID: <200010160222.WAA21686@candle.pha.pa.us> (raw)
In-Reply-To: <39EA4E56.CAD35C88@agliodbs.com>

> KuroiNeko,
> 
> >  I remember from  the old days of Delphi/InterBase, and  even older days of
> > Paradox, there were so called input masks, US phone code mask would be like
> 
> Input masks still exist for some languages (VB, Paradox) but I've found
> that even in those platforms that support them I tend to replace them
> with custom functions, because actually using them is too buggy.

You can use CHECK column constraints to enforce this using regular
expressions in the CHECK.

> 
> >  I'm just not sure what to do if 8 or 9 digits are supplied? Maybe, reject,
> > assuming that  such things should  be caught  by UI, and  if we get  such a
> > weird thing, there's something really really wrong?
> 
> Or, if you're using an interface that doesn't readily support entry
> validation (e.g. PHP) then you can nest functions and have the "Save"
> button test for a reply indicating that something's wrong.
> 
> To wit:
> 
> Create Function save_candidate (Lots of candidate data variables) 
> 	RETURNS VARCHAR (100)
> AS
> 	Declare output_string VARCHAR(100)
> 	Do a whole bunch of stuff
> 	SELECT first_phone = phoneformat(first_phone)
> 	IF first_phone = 'fail' (
> 		SELECT output_string = 'Bad phone number for Primary Phone'
> 		RETURN output_string
> 		)
> 	More code
> 
> -Josh
> 
> -- 
> ______AGLIO DATABASE SOLUTIONS___________________________
>                                         Josh Berkus
>    Complete information technology      josh@agliodbs.com
>     and data management solutions       (415) 436-9166
>    for law firms, small businesses       fax  436-0137
>     and non-profit organizations.       pager 338-4078
>                         		San Francisco
> 


-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026



view thread (10+ messages)  latest in thread

Message-ID: <200010160222.WAA21686@candle.pha.pa.us>
Permalink:  ../200010160222.WAA21686@candle.pha.pa.us/
Also on:    postgresql.org/message-id/200010160222.WAA21686@candle.pha.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: pgman@candle.pha.pa.us, josh@agliodbs.com
  Subject: Re: Variable-length Types
  In-Reply-To: <200010160222.WAA21686@candle.pha.pa.us>
  References: <39EA4E56.CAD35C88@agliodbs.com> <200010160222.WAA21686@candle.pha.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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