pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Chris Browne <cbbrowne@acm.org>
To: " <pgsql-hackers@postgresql.org.pgsql-sql>
Subject: Re: User defined types -- Social Security number...
Date: Tue, 02 Mar 2004 12:30:54 -0500
Message-ID: <60y8qjkvg1.fsf@dev6.int.libertyrms.info> (raw)
References: <c16fu8$2ro4$1@news.hub.org>
	<m37jy5ryto.fsf@wolfe.cbbrowne.com>
	<Pine.LNX.4.58.0403011151340.17082@screamer.tcp-ip.info>
	<200403010942.48760.scrawford@pinpointresearch.com>
	<20040301211843.GB19105@michaelchaney.com>
	<c22ceg$s1a$1@news.hub.org>

"Greg Patnude" <gpatnude@hotmail.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/;



view thread (14+ messages)  latest in thread

Message-ID: <60y8qjkvg1.fsf@dev6.int.libertyrms.info>
Permalink:  ../60y8qjkvg1.fsf@dev6.int.libertyrms.info/
Also on:    postgresql.org/message-id/60y8qjkvg1.fsf@dev6.int.libertyrms.info

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: cbbrowne@acm.org, pgsql-hackers@postgresql.org.pgsql-sql
  Subject: Re: User defined types -- Social Security number...
  In-Reply-To: <60y8qjkvg1.fsf@dev6.int.libertyrms.info>

* 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