Re: HEAD \df doesn't show functions with no arguments
| От | Michael Fuhr |
|---|---|
| Тема | Re: HEAD \df doesn't show functions with no arguments |
| Дата | |
| Msg-id | 20050401053705.GA53134@winnie.fuhr.org обсуждение исходный текст |
| Ответ на | Re: HEAD \df doesn't show functions with no arguments (Bruce Momjian <pgman@candle.pha.pa.us>) |
| Список | pgsql-hackers |
On Fri, Apr 01, 2005 at 12:08:21AM -0500, Bruce Momjian wrote:
> Tom Lane wrote:
> >
> > What makes you think you can't call 'em from SQL?
> >
> > regression=# select int4in('345');
> > int4in
> > --------
> > 345
> > (1 row)
>
> Yes, I guess I mean does it make sense to call them from SQL? Their
> purpose is for internal use, no?
I've used them to effect a cast where one wasn't defined; that might
not be desirable for general use, but it can be handy for quick-n-dirty.
For example, there's no standard cast from bit or varbit to text,
but you can do it with the I/O functions:
CREATE TABLE foo (b varbit, t text);
INSERT INTO foo (b) VALUES (B'10101101');
UPDATE foo SET t = textin(bit_out(b));
SELECT * FROM foo; b | t
----------+----------10101101 | 10101101
(1 row)
--
Michael Fuhr
http://www.fuhr.org/~mfuhr/
В списке pgsql-hackers по дате отправления: