Re: User defined types -- Social Security number...

From: Chris Browne <cbbrowne(at)acm(dot)org>
To: "pgsql-hackers(at)postgresql(dot)org(dot)pgsql-sql"(at)postgresql(dot)org
Subject: Re: User defined types -- Social Security number...
Date: 2004-03-02 17:30:54
Message-ID: 60y8qjkvg1.fsf@dev6.int.libertyrms.info
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-sql

"Greg Patnude" <gpatnude(at)hotmail(dot)com> writes:
> It would be really sweet in postgreSQL if we could apply the
> equivalent of a printf(columnname) to the table definition -- MS
> Access has what they call an "input mask" and it comes in really
> handy -- however -- I havent used Access for anthing serious for
> about 4 years...

Hmm.

% man "create type"

NAME
CREATE TYPE - define a new data type

SYNOPSIS
CREATE TYPE name AS
( attribute_name data_type [, ... ] )

CREATE TYPE name (
INPUT = input_function,
OUTPUT = output_function
[ , RECEIVE = receive_function ]
[ , SEND = send_function ]
[ , INTERNALLENGTH = { internallength | VARIABLE } ]
[ , PASSEDBYVALUE ]
[ , ALIGNMENT = alignment ]
[ , STORAGE = storage ]
[ , DEFAULT = default ]
[ , ELEMENT = element ]
[ , DELIMITER = delimiter ]
)

"input_function" and "output_function" sure _sound_ like what you're
looking for.

They would make your imagined issue of "missing leading zeros" go
away.

I think that CREATE TYPE has been around for a goodly few years now;
it is not impossible that this functionality has been around longer
than MS Access (which is saying something!).
--
output = reverse("gro.mca" "@" "enworbbc")
http://www3.sympatico.ca/cbbrowne/x.html
Rules of the Evil Overlord #116. "If I capture the hero's starship, I
will keep it in the landing bay with the ramp down, only a few token
guards on duty and a ton of explosives set to go off as soon as it
clears the blast-range." <http://www.eviloverlord.com/>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2004-03-02 18:45:21 Re: [GENERAL] select statement against pg_stats returns
Previous Message Fabien COELHO 2004-03-02 17:27:04 Re: [PATCHES] Foreign key type checking patch

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Hebbron 2004-03-03 01:20:43 Re: User defined types -- Social Security number...
Previous Message Ryan Riehle 2004-03-02 17:22:08 Re: Strings in UDFs