X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 74EB8D1B476; Tue, 2 Mar 2004 18:20:39 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 76320-07; Tue, 2 Mar 2004 14:20:37 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 89038D1B565; Tue, 2 Mar 2004 14:20:36 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i22IKZ1Y053611; Tue, 2 Mar 2004 18:20:36 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i22IAaEZ051812; Tue, 2 Mar 2004 18:10:36 GMT From: Chris Browne X-Newsgroups: comp.databases.postgresql.hackers,comp.databases.postgresql.sql Subject: Re: User defined types -- Social Security number... Date: Tue, 02 Mar 2004 12:30:54 -0500 Organization: cbbrowne Computing Inc Lines: 48 Message-ID: <60y8qjkvg1.fsf@dev6.int.libertyrms.info> References: <200403010942.48760.scrawford@pinpointresearch.com> <20040301211843.GB19105@michaelchaney.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@news.hub.org User-Agent: Gnus/5.110002 (No Gnus v0.2) XEmacs/21.4 (Reasonable Discussion, linux) Cancel-Lock: sha1:8BxI2ybn3rsPaQ9pCDgmiYrDDTo= To: "pgsql-hackers@postgresql.org.pgsql-sql"@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200403/25 X-Sequence-Number: 17124 "Greg Patnude" 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."