pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedcreate type question
2+ messages / 2 participants
[nested] [flat]
* create type question
@ 2003-05-12 20:48 John DeSoi <jd@icx.net>
0 siblings, 1 reply; 2+ messages in thread
From: John DeSoi @ 2003-05-12 20:48 UTC (permalink / raw)
To: pgsql-general@postgresql.org
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
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: create type question
@ 2003-05-12 20:58 Stephan Szabo <sszabo@megazone23.bigpanda.com>
parent: John DeSoi <jd@icx.net>
0 siblings, 0 replies; 2+ messages in thread
From: Stephan Szabo @ 2003-05-12 20:58 UTC (permalink / raw)
To: John DeSoi <jd@icx.net>; +Cc: pgsql-general@postgresql.org
On Mon, 12 May 2003, John DeSoi wrote:
> 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?
You might just want to make a domain, something like:
create domain lisp as text;
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2003-05-12 20:58 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-05-12 20:48 create type question John DeSoi <jd@icx.net>
2003-05-12 20:58 ` Stephan Szabo <sszabo@megazone23.bigpanda.com>
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