X-Original-To: pgsql-general@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id A7EF3475A80 for ; Mon, 12 May 2003 16:51:46 -0400 (EDT) Received: from harrier.mail.pas.earthlink.net (harrier.mail.pas.earthlink.net [207.217.120.12]) by postgresql.org (Postfix) with ESMTP id D144B4758F1 for ; Mon, 12 May 2003 16:51:45 -0400 (EDT) Received: from user-1120isb.dsl.mindspring.com ([66.32.75.139] helo=icx.net) by harrier.mail.pas.earthlink.net with esmtp (Exim 3.33 #1) id 19FKGt-0006QW-00 for pgsql-general@postgresql.org; Mon, 12 May 2003 13:51:43 -0700 Date: Mon, 12 May 2003 16:48:59 -0400 Subject: create type question Content-Type: text/plain; charset=US-ASCII; format=flowed Mime-Version: 1.0 (Apple Message framework v552) From: John DeSoi To: pgsql-general@postgresql.org Content-Transfer-Encoding: 7bit In-Reply-To: <20030512120544.5bb9c4c6.lainl@aconectarse.com> Message-Id: <27BDDD9C-84BB-11D7-B522-0030656EE7B2@icx.net> X-Mailer: Apple Mail (2.552) X-Spam-Status: No, hits=-12.1 required=5.0 tests=BAYES_10,IN_REP_TO,USER_AGENT_APPLEMAIL autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200305/372 X-Sequence-Number: 42027 I would like to create a new column type that just holds a text string (a lisp form). My only reason for creating a type is so that I can distinguish this field type from text fields and perform some extended processing when they are read by the client. Below is my first (newbie) attempt. Do I really have to do write something in C to accomplish this? Is there any kind of type "alias" feature? Thanks, John DeSoi, Ph.D. === test=# create function lisp_text (text) returns text as 'select $1;' language sql; CREATE FUNCTION test=# select lisp_text('test 1234'); lisp_text ----------- test 1234 (1 row) test=# create type lisp (input = lisp_text, output = lisp_text, internallength = variable, default = 'nil', delimiter = ' '); ERROR: TypeCreate: function lisp_text(cstring) does not exist test=# create function lisp_text (cstring) returns text as 'select $1;' language sql; ERROR: SQL functions cannot have arguments of type cstring