Skip site navigation (1) Skip section navigation (2)

Re: issue with an assembled date field

From: brian <brian(at)zijn-digital(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: issue with an assembled date field
Date: 2008-02-29 18:53:18
Message-ID: 47C8549E.20702@zijn-digital.com (view raw or flat)
Thread:
Lists: pgsql-general
Chris Bowlby wrote:
> Hi Colin, 
> 
>  Thanks for your response, if I remove the where clause from my example,
> I also am able to execute the query with out issue, as follows:
> 
> test=#  select tab.dr_prod_date FROM (SELECT ('01/01/0'::text ||
> "substring"(ilch.lot_id::text, 5, 1))::date AS dr_prod_date FROM
> my_lot_test ilch) AS tab limit 1;
>  dr_prod_date 
> --------------
>  2007-01-01
> (1 row)
> 

That syntax is incorrect for substring(). Use:

substr(ilch.lot_id::text, 5, 1)

or:

substring(ilch.lot_id::text FROM 5 FOR 1)

In response to

pgsql-general by date

Next:From: Richard HuxtonDate: 2008-02-29 19:04:17
Subject: Re: Insert vs Update syntax
Previous:From: Tom LaneDate: 2008-02-29 18:47:40
Subject: Re: issue with an assembled date field

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group