Re: From 8.1 to 8.3

Lists: pgsql-general
From: S Arvind <arvindwill(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: From 8.1 to 8.3
Date: 2009-04-22 16:42:25
Message-ID: abf9211d0904220942j3fee326k78db0dfd2945055e@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Our company wants to move from 8,1 to 8.3 latest. In irc they told me to
check realse notes for issues while upgrading. But there are lots of release
notesss. Can anyone tell some most noticable change or place-of-error while
upgrading?

Arvind S

*
"Many of lifes failure are people who did not realize how close they were to
success when they gave up."
-Thomas Edison*


From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: S Arvind <arvindwill(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: From 8.1 to 8.3
Date: 2009-04-22 16:49:26
Message-ID: 20090422164926.GA10358@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

S Arvind escribió:
> Our company wants to move from 8,1 to 8.3 latest. In irc they told me to
> check realse notes for issues while upgrading. But there are lots of release
> notesss. Can anyone tell some most noticable change or place-of-error while
> upgrading?

If you're too lazy to read them, we're too lazy to summarise them for
you ...

(Luckily for everybody, Bruce and Tom were NOT lazy enough to write them
in the first place.)

The meat of what you need to know is in the 8.2.0 and 8.3.0 notes, the
"incompatibilities" section anyhow.

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


From: Joao Ferreira gmail <joao(dot)miguel(dot)c(dot)ferreira(at)gmail(dot)com>
To: S Arvind <arvindwill(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: From 8.1 to 8.3
Date: 2009-04-22 16:55:15
Message-ID: 1240419315.4516.69.camel@debj5n.critical.pt
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

On Wed, 2009-04-22 at 22:12 +0530, S Arvind wrote:
> Our company wants to move from 8,1 to 8.3 latest. In irc they told me
> to check realse notes for issues while upgrading. But there are lots
> of release notesss. Can anyone tell some most noticable change or
> place-of-error while upgrading?

one I had to solve was the need for explicit casting in SQL queries that
used numeric comparison of REAL with TEXT...

yes... this used to be possible on 8.1 and is no longer on 8.3

so if your applications have such queries maybe you will bumo into some
problems

I used stuff like this: cast(instantin as numeric)

cheers

Joao

>
> Arvind S
>
>
> "Many of lifes failure are people who did not realize how close they
> were to success when they gave up."
> -Thomas Edison


From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: S Arvind <arvindwill(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: From 8.1 to 8.3
Date: 2009-04-22 16:56:23
Message-ID: 1240419383.2119.68.camel@jd-laptop.pragmaticzealot.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

On Wed, 2009-04-22 at 12:49 -0400, Alvaro Herrera wrote:
> S Arvind escribió:
> > Our company wants to move from 8,1 to 8.3 latest. In irc they told me to
> > check realse notes for issues while upgrading. But there are lots of release
> > notesss. Can anyone tell some most noticable change or place-of-error while
> > upgrading?
>
> If you're too lazy to read them, we're too lazy to summarise them for
> you ...
>

And to actually be helpful, the number one issue people see to run into
is this one:

Non-character data types are no longer automatically cast to
TEXT (Peter, Tom)

Previously, if a non-character value was supplied to an operator
or function that requires text input, it was automatically cast
to text, for most (though not all) built-in data types. This no
longer happens: an explicit cast to text is now required for all
non-character-string types. For example, these expressions
formerly worked:

substr(current_date, 1, 4)
23 LIKE '2%'

but will now draw "function does not exist" and "operator does
not exist" errors respectively. Use an explicit cast instead:

substr(current_date::text, 1, 4)
23::text LIKE '2%'

(Of course, you can use the more verbose CAST() syntax too.) The
reason for the change is that these automatic casts too often
caused surprising behavior. An example is that in previous
releases, this expression was accepted but did not do what was
expected:

current_date < 2017-11-17

This is actually comparing a date to an integer, which should be
(and now is) rejected — but in the presence of automatic casts
both sides were cast to text and a textual comparison was done,
because the text < text operator was able to match the
expression when no other < operator could.

Types char(n) and varchar(n) still cast to text automatically.
Also, automatic casting to text still works for inputs to the
concatenation (||) operator, so long as least one input is a
character-string type.

However Alvaro is right. You should read the entire incompatibilities
section, and of course test.

Sincerely,

Joshua D. Drake

--
PostgreSQL - XMPP: jdrake(at)jabber(dot)postgresql(dot)org
Consulting, Development, Support, Training
503-667-4564 - http://www.commandprompt.com/
The PostgreSQL Company, serving since 1997


From: "Atul Chojar" <achojar(at)airfacts(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Testing ... please reply
Date: 2009-04-22 17:21:49
Message-ID: 008c01c9c36e$d244e880$76ceb980$@com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Could someone reply to this email? I am testing my subscription; joined over 2 months ago, but never get any response to questions

Thanks!
Atul

-----Original Message-----
From: pgsql-general-owner(at)postgresql(dot)org [mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of Joshua D. Drake
Sent: Wednesday, April 22, 2009 12:56 PM
To: Alvaro Herrera
Cc: S Arvind; pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] From 8.1 to 8.3

On Wed, 2009-04-22 at 12:49 -0400, Alvaro Herrera wrote:
> S Arvind escribió:
> > Our company wants to move from 8,1 to 8.3 latest. In irc they told me to
> > check realse notes for issues while upgrading. But there are lots of release
> > notesss. Can anyone tell some most noticable change or place-of-error while
> > upgrading?
>
> If you're too lazy to read them, we're too lazy to summarise them for
> you ...
>

And to actually be helpful, the number one issue people see to run into
is this one:

Non-character data types are no longer automatically cast to
TEXT (Peter, Tom)

Previously, if a non-character value was supplied to an operator
or function that requires text input, it was automatically cast
to text, for most (though not all) built-in data types. This no
longer happens: an explicit cast to text is now required for all
non-character-string types. For example, these expressions
formerly worked:

substr(current_date, 1, 4)
23 LIKE '2%'

but will now draw "function does not exist" and "operator does
not exist" errors respectively. Use an explicit cast instead:

substr(current_date::text, 1, 4)
23::text LIKE '2%'

(Of course, you can use the more verbose CAST() syntax too.) The
reason for the change is that these automatic casts too often
caused surprising behavior. An example is that in previous
releases, this expression was accepted but did not do what was
expected:

current_date < 2017-11-17

This is actually comparing a date to an integer, which should be
(and now is) rejected — but in the presence of automatic casts
both sides were cast to text and a textual comparison was done,
because the text < text operator was able to match the
expression when no other < operator could.

Types char(n) and varchar(n) still cast to text automatically.
Also, automatic casting to text still works for inputs to the
concatenation (||) operator, so long as least one input is a
character-string type.

However Alvaro is right. You should read the entire incompatibilities
section, and of course test.

Sincerely,

Joshua D. Drake

--
PostgreSQL - XMPP: jdrake(at)jabber(dot)postgresql(dot)org
Consulting, Development, Support, Training
503-667-4564 - http://www.commandprompt.com/
The PostgreSQL Company, serving since 1997

--
Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.287 / Virus Database: 270.12.1/2070 - Release Date: 04/22/09 08:49:00


From: Raymond O'Donnell <rod(at)iol(dot)ie>
To: Atul Chojar <achojar(at)airfacts(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Testing ... please reply
Date: 2009-04-22 17:28:08
Message-ID: 49EF53A8.4010806@iol.ie
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

On 22/04/2009 18:21, Atul Chojar wrote:
> Could someone reply to this email? I am testing my subscription;
> joined over 2 months ago, but never get any response to questions

Receiving you loud and clear!

Ray.

------------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod(at)iol(dot)ie
Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
------------------------------------------------------------------


From: Joao Ferreira <jmcferreira(at)critical-links(dot)com>
To: Atul Chojar <achojar(at)airfacts(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Testing ... please reply
Date: 2009-04-22 17:34:25
Message-ID: 1240421665.4516.77.camel@debj5n.critical.pt
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general


Coming loud and clear !

joao

On Wed, 2009-04-22 at 13:21 -0400, Atul Chojar wrote:
> Could someone reply to this email? I am testing my subscription; joined over 2 months ago, but never get any response to questions
>
> Thanks!
> Atul
>
>
>
> -----Original Message-----
> From: pgsql-general-owner(at)postgresql(dot)org [mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of Joshua D. Drake
> Sent: Wednesday, April 22, 2009 12:56 PM
> To: Alvaro Herrera
> Cc: S Arvind; pgsql-general(at)postgresql(dot)org
> Subject: Re: [GENERAL] From 8.1 to 8.3
>
> On Wed, 2009-04-22 at 12:49 -0400, Alvaro Herrera wrote:
> > S Arvind escribió:
> > > Our company wants to move from 8,1 to 8.3 latest. In irc they told me to
> > > check realse notes for issues while upgrading. But there are lots of release
> > > notesss. Can anyone tell some most noticable change or place-of-error while
> > > upgrading?
> >
> > If you're too lazy to read them, we're too lazy to summarise them for
> > you ...
> >
>
> And to actually be helpful, the number one issue people see to run into
> is this one:
>
> Non-character data types are no longer automatically cast to
> TEXT (Peter, Tom)
>
> Previously, if a non-character value was supplied to an operator
> or function that requires text input, it was automatically cast
> to text, for most (though not all) built-in data types. This no
> longer happens: an explicit cast to text is now required for all
> non-character-string types. For example, these expressions
> formerly worked:
>
> substr(current_date, 1, 4)
> 23 LIKE '2%'
>
> but will now draw "function does not exist" and "operator does
> not exist" errors respectively. Use an explicit cast instead:
>
> substr(current_date::text, 1, 4)
> 23::text LIKE '2%'
>
> (Of course, you can use the more verbose CAST() syntax too.) The
> reason for the change is that these automatic casts too often
> caused surprising behavior. An example is that in previous
> releases, this expression was accepted but did not do what was
> expected:
>
> current_date < 2017-11-17
>
> This is actually comparing a date to an integer, which should be
> (and now is) rejected — but in the presence of automatic casts
> both sides were cast to text and a textual comparison was done,
> because the text < text operator was able to match the
> expression when no other < operator could.
>
> Types char(n) and varchar(n) still cast to text automatically.
> Also, automatic casting to text still works for inputs to the
> concatenation (||) operator, so long as least one input is a
> character-string type.
>
> However Alvaro is right. You should read the entire incompatibilities
> section, and of course test.
>
> Sincerely,
>
> Joshua D. Drake
>
> --
> PostgreSQL - XMPP: jdrake(at)jabber(dot)postgresql(dot)org
> Consulting, Development, Support, Training
> 503-667-4564 - http://www.commandprompt.com/
> The PostgreSQL Company, serving since 1997
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 8.5.287 / Virus Database: 270.12.1/2070 - Release Date: 04/22/09 08:49:00
>
>


From: "Atul Chojar" <achojar(at)airfacts(dot)com>
To: "'Joao Ferreira'" <jmcferreira(at)critical-links(dot)com>, <pgsql-general-owner(at)postgresql(dot)org>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: thanks for the "testing" replies ; now my first question - Logs say update done but not actually done or committed into database
Date: 2009-04-22 18:15:22
Message-ID: 009f01c9c376$4e6b4560$eb41d020$@com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Thanks to everyone who replied to the test email!

Now for my real question:-

We are facing a strange problem in our 8.2.7 database.

There is a bash shell script that does:-

sql=”select distinct to_char(date_of_issue, ‘YYYYMM’) from yan.int_prod_s_master order by 1;”
YYYYMM=`/usr/local/pgsql/bin/psql -U postgres -h payday -d sandbox -t -c “$sql”`
for x in $YYYYMM
do
$scriptdir/USCS_production_updates.sh $x >>$logdir/USCS_production_updates.log 2>&1
done

The $scriptdir/USCS_production_updates.sh script does updates like:-

YYYYMM=$1
database=”us_audit”
db_user=”postgres”
db_host=”nutrageous”
psql_cmd=”/usr/local/pgsql/bin/psql -U ${db_user} -h ${db_host} -d ${database} -e “;
sql=”
update int_prod_manual_price_${YYYYMM} mp
set …
from int_prod_s_master_${YYYYMM} sm
where …
and not exists ( select 1 from int_prod_stop_${YYYYMM} where …)
and …;
“;
$psql_cmd -c “$SQL”

When these scripts run, the USCS_production_updates.log shows the correct update statement, with values of YYYYMM substituted in the table names, and message like “UPDATE 1025” from postgres indicating 1025 rows got updated.

However, none of these updates actually get applied in the database. Auto commit is on in the database, but it seems the updates do not get committed.

The system logs also show no errors.

Any ideas why above update is not working?

Thanks!
Atul

-----Original Message-----
From: pgsql-general-owner(at)postgresql(dot)org [mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of Joao Ferreira
Sent: Wednesday, April 22, 2009 1:34 PM
To: Atul Chojar
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] Testing ... please reply

Coming loud and clear !

joao

On Wed, 2009-04-22 at 13:21 -0400, Atul Chojar wrote:
> Could someone reply to this email? I am testing my subscription; joined over 2 months ago, but never get any response to questions
>
> Thanks!
> Atul
>
>
>
> -----Original Message-----
> From: pgsql-general-owner(at)postgresql(dot)org [mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of Joshua D. Drake
> Sent: Wednesday, April 22, 2009 12:56 PM
> To: Alvaro Herrera
> Cc: S Arvind; pgsql-general(at)postgresql(dot)org
> Subject: Re: [GENERAL] From 8.1 to 8.3
>
> On Wed, 2009-04-22 at 12:49 -0400, Alvaro Herrera wrote:
> > S Arvind escribió:
> > > Our company wants to move from 8,1 to 8.3 latest. In irc they told me to
> > > check realse notes for issues while upgrading. But there are lots of release
> > > notesss. Can anyone tell some most noticable change or place-of-error while
> > > upgrading?
> >
> > If you're too lazy to read them, we're too lazy to summarise them for
> > you ...
> >
>
> And to actually be helpful, the number one issue people see to run into
> is this one:
>
> Non-character data types are no longer automatically cast to
> TEXT (Peter, Tom)
>
> Previously, if a non-character value was supplied to an operator
> or function that requires text input, it was automatically cast
> to text, for most (though not all) built-in data types. This no
> longer happens: an explicit cast to text is now required for all
> non-character-string types. For example, these expressions
> formerly worked:
>
> substr(current_date, 1, 4)
> 23 LIKE '2%'
>
> but will now draw "function does not exist" and "operator does
> not exist" errors respectively. Use an explicit cast instead:
>
> substr(current_date::text, 1, 4)
> 23::text LIKE '2%'
>
> (Of course, you can use the more verbose CAST() syntax too.) The
> reason for the change is that these automatic casts too often
> caused surprising behavior. An example is that in previous
> releases, this expression was accepted but did not do what was
> expected:
>
> current_date < 2017-11-17
>
> This is actually comparing a date to an integer, which should be
> (and now is) rejected — but in the presence of automatic casts
> both sides were cast to text and a textual comparison was done,
> because the text < text operator was able to match the
> expression when no other < operator could.
>
> Types char(n) and varchar(n) still cast to text automatically.
> Also, automatic casting to text still works for inputs to the
> concatenation (||) operator, so long as least one input is a
> character-string type.
>
> However Alvaro is right. You should read the entire incompatibilities
> section, and of course test.
>
> Sincerely,
>
> Joshua D. Drake
>
> --
> PostgreSQL - XMPP: jdrake(at)jabber(dot)postgresql(dot)org
> Consulting, Development, Support, Training
> 503-667-4564 - http://www.commandprompt.com/
> The PostgreSQL Company, serving since 1997
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 8.5.287 / Virus Database: 270.12.1/2070 - Release Date: 04/22/09 08:49:00
>
>

--
Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.287 / Virus Database: 270.12.1/2070 - Release Date: 04/22/09 08:49:00


From: Filip Rembiałkowski <plk(dot)zuber(at)gmail(dot)com>
To: Atul Chojar <achojar(at)airfacts(dot)com>
Cc: Joao Ferreira <jmcferreira(at)critical-links(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: thanks for the "testing" replies ; now my first question - Logs say update done but not actually done or committed into database
Date: 2009-04-22 20:17:08
Message-ID: 92869e660904221317s48aa1566h3882c01dcee2dd5@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

2009/4/22 Atul Chojar <achojar(at)airfacts(dot)com>

>
> We are facing a strange problem in our 8.2.7 database.
>
> There is a bash shell script that does:-
>
> sql=”select distinct to_char(date_of_issue, ‘YYYYMM’) from
> yan.int_prod_s_master order by 1;”
> YYYYMM=`/usr/local/pgsql/bin/psql -U postgres -h payday -d sandbox -t -c
> “$sql”`
> for x in $YYYYMM
> do
> $scriptdir/USCS_production_updates.sh $x
> >>$logdir/USCS_production_updates.log 2>&1
> done
>
> The $scriptdir/USCS_production_updates.sh script does updates like:-
>
> YYYYMM=$1
> database=”us_audit”
> db_user=”postgres”
> db_host=”nutrageous”
> psql_cmd=”/usr/local/pgsql/bin/psql -U ${db_user} -h ${db_host} -d
> ${database} -e “;
> sql=”
> update int_prod_manual_price_${YYYYMM} mp
> set …
> from int_prod_s_master_${YYYYMM} sm
> where …
> and not exists ( select 1 from int_prod_stop_${YYYYMM} where …)
> and …;
> “;
> $psql_cmd -c “$SQL”
>
> When these scripts run, the USCS_production_updates.log shows the correct
> update statement, with values of YYYYMM substituted in the table names, and
> message like “UPDATE 1025” from postgres indicating 1025 rows got updated.
>
> However, none of these updates actually get applied in the database. Auto
> commit is on in the database, but it seems the updates do not get committed.
>
> The system logs also show no errors.
>
> Any ideas why above update is not working?
>
>
hi,

1. if you run the very same UPDATE manually, does it work?
2. do you have any triggers on these tables? it's possible that they prevent
updates from happening.
3. if you have table with same name but in different schema, and specific
search_path, this could be a reason too.

HTH

PS. you don't have to post such questions to list owner :)

--
Filip Rembiałkowski
JID,mailto:filip(dot)rembialkowski(at)gmail(dot)com
http://filip.rembialkowski.net/


From: "Atul Chojar" <achojar(at)airfacts(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Cc: "Andy" <ayoder(at)airfacts(dot)com>
Subject: How to pass parameters into a sql script ?
Date: 2009-05-28 14:50:20
Message-ID: 003a01c9dfa3$9f750740$de5f15c0$@com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

We are unable to pass parameters into any sql script. Could anyone look at the test below and give any suggestions? PostgreSQL version is 8.2.7, running on Linux.

Test Script

========

$ cat chk_param.sql

select ''''||:p_date::char(8)||'''';

select count(*) from prod_debit_payments_unapplied where when_received = (select ''''||:p_date::char(8)||'''');

select count(*) from prod_debit_payments_unapplied where when_received = '20081023';

Test Results

=========

$ psql -d us_audit -e -1 -v p_date='20081023' -f chk_param.sql

Timing is on.

select ''''||20081023::char(8)||'''';

?column?

------------

'20081023'

(1 row)

Time: 1.474 ms

select count(*) from prod_debit_payments_unapplied where when_received = (select ''''||20081023::char(8)||'''');--same results with direct assignment and to_date

count

-------

0

(1 row)

Time: 36.290 ms

select count(*) from prod_debit_payments_unapplied where when_received = '20081023';

count

-------

193

(1 row)

Time: 17.722 ms

Thanks!

atul

<http://www.airfacts.com/> AirFacts, Inc.8120 Woodmont Ave., Suite 700Bethesda, MD 20814Tel: 301-760-7315


From: Osvaldo Kussama <osvaldo(dot)kussama(at)gmail(dot)com>
To: Atul Chojar <achojar(at)airfacts(dot)com>
Cc: pgsql-general(at)postgresql(dot)org, Andy <ayoder(at)airfacts(dot)com>
Subject: Re: How to pass parameters into a sql script ?
Date: 2009-05-28 19:42:42
Message-ID: 690707f60905281242h6d85af5cme9e188181866b0c9@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

2009/5/28 Atul Chojar <achojar(at)airfacts(dot)com>:
> We are unable to pass parameters into any sql script. Could anyone look at
> the test below and give any suggestions? PostgreSQL version is 8.2.7,
> running on Linux.
>
>
>
> Test Script
>
> ========
>
> $ cat chk_param.sql
>
> select ''''||:p_date::char(8)||'''';
>
> select count(*) from prod_debit_payments_unapplied where when_received =
> (select ''''||:p_date::char(8)||'''');
>
> select count(*) from prod_debit_payments_unapplied where when_received =
> '20081023';
>
>
>
> Test Results
>
> =========
>
> $ psql -d us_audit -e -1 -v p_date='20081023' -f chk_param.sql
>
> Timing is on.
>
> select ''''||20081023::char(8)||'''';
>
>   ?column?
>
> ------------
>
>  '20081023'
>
> (1 row)
>
>
>
> Time: 1.474 ms
>
> select count(*) from prod_debit_payments_unapplied where when_received =
> (select ''''||20081023::char(8)||'''');--same results with direct assignment
> and to_date
>
>  count
>
> -------
>
>      0
>
> (1 row)
>
>
>
> Time: 36.290 ms
>
> select count(*) from prod_debit_payments_unapplied where when_received =
> '20081023';
>
>  count
>
> -------
>
>    193
>
> (1 row)
>
>
>
> Time: 17.722 ms
>

bdteste=# select '20081023' = ''''||20081023::char(8)||'''';
?column?
----------
f
(1 registro)

bdteste=# select '20081023', length('20081023'),
''''||20081023::char(8)||'''', length(''''||20081023::char(8)||'''');
?column? | length | ?column? | length
----------+--------+------------+--------
20081023 | 8 | '20081023' | 10
(1 registro)

Osvaldo