pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedproblem with casting
3+ messages / 3 participants
[nested] [flat]
* problem with casting
@ 2001-02-14 21:10 postgresql <pgsql@symcom.com>
0 siblings, 2 replies; 3+ messages in thread
From: postgresql @ 2001-02-14 21:10 UTC (permalink / raw)
To: pgsql-sql
I have a table that has a 'date' column. In psql I tried to do a
select proofdate::text from openjobs where jobno = '10625';
responce: can not cast type 'date' to 'text'
Did i miss-read this section. I thought I could cast the date to text. has anyone seen
this or am I missreading the docs?
thanks
Ted
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: problem with casting
@ 2001-02-15 09:39 Gighen Daisuku <gighen.daisuku@SUCKYOURSPAMlibero.it>
parent: postgresql <pgsql@symcom.com>
1 sibling, 0 replies; 3+ messages in thread
From: gighen.daisuku@SUCKYOURSPAMlibero.it @ 2001-02-15 09:39 UTC (permalink / raw)
To: pgsql-sql
In data Wed, 14 Feb 2001 21:10:30 +0000 (UTC), postgresql scrive:
>I have a table that has a 'date' column. In psql I tried to do a
>
>select proofdate::text from openjobs where jobno = '10625';
>
>responce: can not cast type 'date' to 'text'
>
>Did i miss-read this section. I thought I could cast the date to text. has anyone seen
>this or am I missreading the docs?
>
select to_char(proofdate, 'dd/mm/yyyy') from openjobs where jobno = '10625';
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: problem with casting
@ 2001-02-15 16:30 Josh Berkus <josh@agliodbs.com>
parent: postgresql <pgsql@symcom.com>
1 sibling, 0 replies; 3+ messages in thread
From: Josh Berkus @ 2001-02-15 16:30 UTC (permalink / raw)
To: postgresql <pgsql@symcom.com>; pgsql-sql
Ted,
> responce: can not cast type 'date' to 'text'
>
> Did i miss-read this section. I thought I could cast the date to text. has anyone seen
> this or am I missreading the docs?
'fraid so. You cannot cast Date as Text, because (presumably) the DB
engine doesn't know how you want to format the date. Instead, use the
to_char builtin function, as defined in the docs:
http://www.postgresql.org/users-lounge/docs/7.0/postgres/functions2976.htm
Share & Enjoy!
-Josh Berkus
--
______AGLIO DATABASE SOLUTIONS___________________________
Josh Berkus
Complete information technology josh@agliodbs.com
and data management solutions (415) 565-7293
for law firms, small businesses fax 621-2533
and non-profit organizations. San Francisco
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2001-02-15 16:30 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-02-14 21:10 problem with casting postgresql <pgsql@symcom.com>
2001-02-15 09:39 ` Gighen Daisuku <gighen.daisuku@SUCKYOURSPAMlibero.it>
2001-02-15 16:30 ` Josh Berkus <josh@agliodbs.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