Re: Casting varchar to interval.? - Mailing list pgsql-general

From Richard Huxton
Subject Re: Casting varchar to interval.?
Date
Msg-id 200401261551.15243.dev@archonet.com
Whole thread Raw
In response to Re: Casting varchar to interval.?  ("Jim Wilson" <jimw@kelcomaine.com>)
Responses Re: Casting varchar to interval.?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On Monday 26 January 2004 14:43, Jim Wilson wrote:
> Is this a bug?  You can work around it by wrapping the varying in a trim()
> function (e.g. select trim(config_value)::interval from config).  I've
> solved another suspicious looking issue with that same kind of workaround.

The trim() is probably a coincidence (although I haven't tested extensively).
The issue is that there is a cast from text => interval but not from varchar.
The solution is to do something like:
  config_value::text::interval
This might be fixed in 7.4.1, but you'll need to check.

--
  Richard Huxton
  Archonet Ltd

pgsql-general by date:

Previous
From: Richard Huxton
Date:
Subject: Re: Storing Configuration settings for a database?
Next
From: Eric Ridge
Date:
Subject: Re: Storing Configuration settings for a database?