| From: | John DeSoi <jd(at)icx(dot)net> | 
|---|---|
| To: | pgsql-general(at)postgresql(dot)org | 
| Subject: | create type question | 
| Date: | 2003-05-12 20:48:59 | 
| Message-ID: | 27BDDD9C-84BB-11D7-B522-0030656EE7B2@icx.net | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-general pgsql-sql | 
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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Stephan Szabo | 2003-05-12 20:58:14 | Re: create type question | 
| Previous Message | Ian Barwick | 2003-05-12 20:47:22 | Re: Unicode confusion | 
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Stephan Szabo | 2003-05-12 20:58:14 | Re: create type question | 
| Previous Message | Achilleus Mantzios | 2003-05-12 20:39:59 | Re: epoch to timestamp |