pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jose' Soares Da Silva <sferac@bo.nettuno.it>
To: Richard Lynch <lynch@lscorp.com>
Cc: Herouth Maoz <herouth@oumail.openu.ac.il>
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] cast text as date
Date: Wed, 17 Jun 1998 12:23:51 +0000 (UTC)
Message-ID: <Pine.LNX.3.96.980617121743.1509D-100000@proxy.bazzanese.com> (raw)
In-Reply-To: <v02140b2db1ac19f0a146@[207.152.64.133]>

On Tue, 16 Jun 1998, Richard Lynch wrote:

> >At 11:14 +0300 on 16/6/98, Richard Lynch wrote:
> >
> >
> >> I've never created a function of my own, and maybe that's the way to go,
> >> but I'm not sure where to start...
> >> The strings in question actually only have a month/year (no date), if that
> >> matters (they're expirations)...
> >> The resulting date can just default to 1 for the date.
> >
> >What version of Postgres, and what error, exactly, did it report?
> 
> ERROR:  function date(text) does not exist
> 
Is possible convert a DATETIME into:
    
                    abstime
		    date
		    text
	            time

prova=> \d tab

Table    = tab
+------------------------------+----------------------------------+-------+
|          Field               |              Type                | Length|
+------------------------------+----------------------------------+-------+
| b                            | datetime                         |     8 |
+------------------------------+----------------------------------+-------+

prova=> select cast(b as text) from tab;
text
----------------------
1998-12-12 00:00:00+01
(1 row)

prova=> select cast(b as date) from tab;
date
----------
1998-12-12
(1 row)

prova=> select cast(b as time) from tab;
time
--------
00:00:00
(1 row)
prova=> select cast(b as abstime) from tab;
abstime
----------------------
1998-12-12 00:00:00+01
(1 row)

> I don't know what version because my ISP installed it, and there seems to
> be no file I can read that tells me, and postmaster -v isn't defined.
> 
> There are two postgresql directories.  One is labeled 6.2.1
> The other is just pgsql.
> 
> The ISP changed psql very recently to require me to use -u and an login
> name and password, when they moved their software to a shiny new box, and
> (I think) upgraded postgresql, if that is any help at all in identifying
> the version.
> 
                                           Jose'




view thread (5+ messages)

Message-ID: <Pine.LNX.3.96.980617121743.1509D-100000@proxy.bazzanese.com>
Permalink:  ../Pine.LNX.3.96.980617121743.1509D-100000@proxy.bazzanese.com/
Also on:    postgresql.org/message-id/Pine.LNX.3.96.980617121743.1509D-100000@proxy.bazzanese.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: sferac@bo.nettuno.it, lynch@lscorp.com, herouth@oumail.openu.ac.il
  Subject: Re: [SQL] cast text as date
  In-Reply-To: <Pine.LNX.3.96.980617121743.1509D-100000@proxy.bazzanese.com>
  References: <v02140b2db1ac19f0a146@[207.152.64.133]> <Pine.LNX.3.96.980617121743.1509D-100000@proxy.bazzanese.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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