pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: John DeSoi <jd@icx.net>
To: pgsql-general@postgresql.org
Subject: create type question
Date: Mon, 12 May 2003 16:48:59 -0400
Message-ID: <27BDDD9C-84BB-11D7-B522-0030656EE7B2@icx.net> (raw)
In-Reply-To: <20030512120544.5bb9c4c6.lainl@aconectarse.com>

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




view thread (2+ messages)  latest in thread

Message-ID: <27BDDD9C-84BB-11D7-B522-0030656EE7B2@icx.net>
Permalink:  ../27BDDD9C-84BB-11D7-B522-0030656EE7B2@icx.net/
Also on:    postgresql.org/message-id/27BDDD9C-84BB-11D7-B522-0030656EE7B2@icx.net

 · 

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: jd@icx.net, pgsql-general@postgresql.org
  Subject: Re: create type question
  In-Reply-To: <27BDDD9C-84BB-11D7-B522-0030656EE7B2@icx.net>
  References: <20030512120544.5bb9c4c6.lainl@aconectarse.com> <27BDDD9C-84BB-11D7-B522-0030656EE7B2@icx.net>

* 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