| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | "Robert Wimmer" <seppwimmer(at)hotmail(dot)com> |
| Cc: | pgsql-novice(at)postgresql(dot)org |
| Subject: | Re: CREATE CAST question |
| Date: | 2005-08-06 04:20:24 |
| Message-ID: | 15155.1123302024@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-novice |
"Robert Wimmer" <seppwimmer(at)hotmail(dot)com> writes:
> I want to define a schema qualified domain and create a cast to cast a
> string in the new domain.
Casts between domains and their underlying types are hard-wired into the
system: you don't get to muck with the semantics by doing CREATE CAST.
The correct way to do this is to define a constraint on the domain,
along the lines of
create function is_ok_ident(text) returns bool as '
... return true if you like the string ...
' language plpgsql;
create domain ident as text check (is_ok_ident(value));
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2005-08-06 04:50:45 | Re: Monitoring postmaster.log |
| Previous Message | Robert Wimmer | 2005-08-05 23:04:50 | CREATE CAST question |