8.3beta bug or feature?

Started by marcelo Cortezabout 18 years ago11 messagesgeneral
Jump to latest
#1marcelo Cortez
jmdc_marcelo@yahoo.com.ar

folks

the follow queries work in postgres 8.2 but
in 8.3beta don't work

SELECT c.* FROM c WHERE c.numero LIKE '1%';

i think automatic conversion of numeber to text is
the problem , in 8.3beta don't work
numero field is integer type
any ideas?

best regards
mdc

ps:"PostgreSQL 8.3beta3 on i686-pc-linux-gnu, compiled
by GCC gcc (GCC) 4.1.2 (Gentoo 4.1.2 p1.0.1)"

ERROR: operator does not exist: integer ~~ unknown
LINE 2: c.numero LIKE '1%')

^
HINT: No operator matches the given name and argument
type(s). You might need to add explicit type casts.

********** Error **********

ERROR: operator does not exist: integer ~~ unknown
Estado SQL:42883
Sugerencias:No operator matches the given name and
argument type(s). You might need to add explicit type
casts.
Caracter: 141

Tarjeta de cr�dito Yahoo! de Banco Supervielle.
Solicit� tu nueva Tarjeta de cr�dito. De tu PC directo a tu casa. www.tuprimeratarjeta.com.ar

#2Pavel Stehule
pavel.stehule@gmail.com
In reply to: marcelo Cortez (#1)
Re: 8.3beta bug or feature?

Hello,

it isn't bug. You have to cast to string before.

http://www.postgresql.org/docs/8.3/static/release-8-3.html
E.1.2.1. General

Regards
Pavel Stehule

Show quoted text

On 10/01/2008, marcelo Cortez <jmdc_marcelo@yahoo.com.ar> wrote:

folks

the follow queries work in postgres 8.2 but
in 8.3beta don't work

SELECT c.* FROM c WHERE c.numero LIKE '1%';

i think automatic conversion of numeber to text is
the problem , in 8.3beta don't work
numero field is integer type
any ideas?

best regards
mdc

ps:"PostgreSQL 8.3beta3 on i686-pc-linux-gnu, compiled
by GCC gcc (GCC) 4.1.2 (Gentoo 4.1.2 p1.0.1)"

ERROR: operator does not exist: integer ~~ unknown
LINE 2: c.numero LIKE '1%')

^
HINT: No operator matches the given name and argument
type(s). You might need to add explicit type casts.

********** Error **********

ERROR: operator does not exist: integer ~~ unknown
Estado SQL:42883
Sugerencias:No operator matches the given name and
argument type(s). You might need to add explicit type
casts.
Caracter: 141

Tarjeta de crédito Yahoo! de Banco Supervielle.
Solicitá tu nueva Tarjeta de crédito. De tu PC directo a tu casa. www.tuprimeratarjeta.com.ar

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org/

#3Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: marcelo Cortez (#1)
Re: 8.3beta bug or feature?

marcelo Cortez escribi�:

folks

the follow queries work in postgres 8.2 but
in 8.3beta don't work

SELECT c.* FROM c WHERE c.numero LIKE '1%';

i think automatic conversion of numeber to text is
the problem , in 8.3beta don't work
numero field is integer type

This is regarded as a feature by some, bug by others. It's an
intentional change either way. You can work around it:

SELECT c.* FROM c WHERE c.numero::text LIKE '1%';

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

#4marcelo Cortez
jmdc_marcelo@yahoo.com.ar
In reply to: Pavel Stehule (#2)
Re: 8.3beta bug or feature?

Pavel

--- Pavel Stehule <pavel.stehule@gmail.com> escribi�:

Hello,

it isn't bug. You have to cast to string before.

http://www.postgresql.org/docs/8.3/static/release-8-3.html

E.1.2.1. General

Yes you are right, but my queries was generated for
one mapper ,explicit cast is not an option ( not
manual code here).
there any way simulate previous behavior? (automatic
conversion), create cast can help?
best regards.

mdc

Regards
Pavel Stehule

On 10/01/2008, marcelo Cortez
<jmdc_marcelo@yahoo.com.ar> wrote:

folks

the follow queries work in postgres 8.2 but
in 8.3beta don't work

SELECT c.* FROM c WHERE c.numero LIKE '1%';

i think automatic conversion of numeber to text

is

the problem , in 8.3beta don't work
numero field is integer type
any ideas?

best regards
mdc

ps:"PostgreSQL 8.3beta3 on i686-pc-linux-gnu,

compiled

by GCC gcc (GCC) 4.1.2 (Gentoo 4.1.2 p1.0.1)"

ERROR: operator does not exist: integer ~~

unknown

LINE 2: c.numero LIKE '1%')

^
HINT: No operator matches the given name and

argument

type(s). You might need to add explicit type

casts.

********** Error **********

ERROR: operator does not exist: integer ~~ unknown
Estado SQL:42883
Sugerencias:No operator matches the given name and
argument type(s). You might need to add explicit

type

casts.
Caracter: 141

Tarjeta de cr�dito Yahoo! de Banco

Supervielle.

Solicit� tu nueva Tarjeta de cr�dito. De tu PC

directo a tu casa. www.tuprimeratarjeta.com.ar

---------------------------(end of

broadcast)---------------------------

TIP 4: Have you searched our list archives?

http://archives.postgresql.org/

Los referentes m�s importantes en compra/ venta de autos se juntaron:
Demotores y Yahoo!
Ahora comprar o vender tu auto es m�s f�cil. Vist� ar.autos.yahoo.com/

#5Erik Jones
erik@myemma.com
In reply to: marcelo Cortez (#1)
Re: 8.3beta bug or feature?

On Jan 10, 2008, at 10:47 AM, marcelo Cortez wrote:

folks

the follow queries work in postgres 8.2 but
in 8.3beta don't work

SELECT c.* FROM c WHERE c.numero LIKE '1%';

i think automatic conversion of numeber to text is
the problem , in 8.3beta don't work
numero field is integer type
any ideas?

Read the release notes :) Implicit casts from non-text types to text
have been removed. The easiest solution is to use an explicit cast:

SELECT c.* FROM c WHERE c.numero::text LIKE '1%';

I can definitely see this being an 8.3 faq.

Erik Jones

DBA | Emma®
erik@myemma.com
800.595.4401 or 615.292.5888
615.292.0777 (fax)

Emma helps organizations everywhere communicate & market in style.
Visit us online at http://www.myemma.com

#6Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: marcelo Cortez (#4)
Re: 8.3beta bug or feature?

marcelo Cortez escribi�:

Pavel

--- Pavel Stehule <pavel.stehule@gmail.com> escribi�:

Hello,

it isn't bug. You have to cast to string before.

http://www.postgresql.org/docs/8.3/static/release-8-3.html

E.1.2.1. General

Yes you are right, but my queries was generated for
one mapper ,explicit cast is not an option ( not
manual code here).
there any way simulate previous behavior? (automatic
conversion), create cast can help?

The cast already exist; I think you could change its context (from
"explicit" to "assignment" IIRC). This is, of course, not recommended.

The operation you show is a pretty stupid thing for a mapper to do
anyway ... I suggest you fix it.

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

#7marcelo Cortez
jmdc_marcelo@yahoo.com.ar
In reply to: Alvaro Herrera (#6)
Re: 8.3beta bug or feature?

Alvaro

--- Alvaro Herrera <alvherre@commandprompt.com>
escribi�:

marcelo Cortez escribi�:

Pavel

--- Pavel Stehule <pavel.stehule@gmail.com>

escribi�:

Hello,

it isn't bug. You have to cast to string before.

http://www.postgresql.org/docs/8.3/static/release-8-3.html

E.1.2.1. General

Yes you are right, but my queries was generated

for

one mapper ,explicit cast is not an option ( not
manual code here).
there any way simulate previous behavior?

(automatic

conversion), create cast can help?

The cast already exist; I think you could change its
context (from
"explicit" to "assignment" IIRC). This is, of
course, not recommended.

The operation you show is a pretty stupid thing for
a mapper to do
anyway ... I suggest you fix it.

yeap i know , but it's third part component,fix it is
not an option this time, previous version of my
application works fine in 8.2, but i need 8.3
features like fts and others.

best regards.
mdc

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

---------------------------(end of
broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please
send an appropriate
subscribe-nomail command to
majordomo@postgresql.org so that your
message can get through to the mailing list
cleanly

Los referentes m�s importantes en compra/ venta de autos se juntaron:
Demotores y Yahoo!
Ahora comprar o vender tu auto es m�s f�cil. Vist� ar.autos.yahoo.com/

#8Tom Lane
tgl@sss.pgh.pa.us
In reply to: marcelo Cortez (#7)
Re: 8.3beta bug or feature?

marcelo Cortez <jmdc_marcelo@yahoo.com.ar> writes:

--- Alvaro Herrera <alvherre@commandprompt.com>
escribi�:

The operation you show is a pretty stupid thing for
a mapper to do anyway ... I suggest you fix it.

yeap i know , but it's third part component,fix it is
not an option this time,

Well, then the third party had better be fixing it, and PDQ too.
Unless they plan to abandon their product when 8.3 comes out.

regards, tom lane

#9marcelo Cortez
jmdc_marcelo@yahoo.com.ar
In reply to: Alvaro Herrera (#6)
Re: 8.3beta bug or feature?

Alvaro

--- Alvaro Herrera <alvherre@commandprompt.com>
escribi�:

marcelo Cortez escribi�:

Pavel

--- Pavel Stehule <pavel.stehule@gmail.com>

escribi�:

Hello,

it isn't bug. You have to cast to string before.

http://www.postgresql.org/docs/8.3/static/release-8-3.html

E.1.2.1. General

Yes you are right, but my queries was generated

for

one mapper ,explicit cast is not an option ( not
manual code here).
there any way simulate previous behavior?

(automatic

conversion), create cast can help?

The cast already exist; I think you could change its
context (from
"explicit" to "assignment" IIRC). This is, of
course, not recommended.

I've created cast with assignment from in4 to text

but
select 23 LIKE '2%' fail.
ERROR: operator does not exist: integer ~~ unknown
LINE 1: select 23 LIKE '2%'
^
HINT: No operator matches the given name and argument
type(s). You might need to add explicit type casts.

********** Error **********

ERROR: operator does not exist: integer ~~ unknown
Estado SQL:42883
Sugerencias:No operator matches the given name and
argument type(s). You might need to add explicit type
casts.
Caracter: 12

and i try with

select 23 ::int4 LIKE '2%' text

added explicit cast thinking in .. 'integer ~~
unknown' unknow word .. confuse to me.

nothing is working
any ideas?
is posible to locate changes ( into sources) to
revert behavior to previous 2.8x version?
best regards
mdc

The operation you show is a pretty stupid thing for
a mapper to do
anyway ... I suggest you fix it.

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

---------------------------(end of
broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please
send an appropriate
subscribe-nomail command to
majordomo@postgresql.org so that your
message can get through to the mailing list
cleanly

Tarjeta de cr�dito Yahoo! de Banco Supervielle.
Solicit� tu nueva Tarjeta de cr�dito. De tu PC directo a tu casa. www.tuprimeratarjeta.com.ar

#10Jeff Davis
pgsql@j-davis.com
In reply to: marcelo Cortez (#9)
Re: 8.3beta bug or feature?

On Thu, 2008-01-10 at 16:19 -0300, marcelo Cortez wrote:

The cast already exist; I think you could change its
context (from
"explicit" to "assignment" IIRC). This is, of
course, not recommended.

I've created cast with assignment from in4 to text

but
select 23 LIKE '2%' fail.
ERROR: operator does not exist: integer ~~ unknown
LINE 1: select 23 LIKE '2%'
^
HINT: No operator matches the given name and argument
type(s). You might need to add explicit type casts.

First of all, I think Alvaro meant "change to implicit", I don't think
"assignment" will help.

Second, assuming that works for that specific case (which it may or may
not, I haven't tried it), it's still not a good solution for you.
Implicit type coercion causes all kinds of subtle problems that are hard
to see, which is why the change was made in 8.3.

And if I understand correctly, just changing a few casts to "implicit"
will not result in behavior the same as 8.2, so it's likely to break
other parts of the application.

I don't think there's any way around fixing the application. You can
still use 8.2 with tsearch2 (which still work great) until the mapper is
fixed.

What is the name of the third-party product?

Regards,
Jeff Davis

#11marcelo Cortez
jmdc_marcelo@yahoo.com.ar
In reply to: Tom Lane (#8)
Re: [GENERAL] 8.3beta bug or feature?

Tom

--- Tom Lane <tgl@sss.pgh.pa.us> escribi�:

marcelo Cortez <jmdc_marcelo@yahoo.com.ar> writes:

--- Alvaro Herrera <alvherre@commandprompt.com>
escribi�:

The operation you show is a pretty stupid thing

for

a mapper to do anyway ... I suggest you fix it.

yeap i know , but it's third part component,fix

it is

not an option this time,

Well, then the third party had better be fixing it,
and PDQ too.
Unless they plan to abandon their product when 8.3
comes out.

Actually i have the sources but it's difficult to fix
them.
Long explanation: I work in smalltalk language, the
framework for mapping is third party component.
The smalltalk that I use it's not open source (but
there are some open source smalltalks), but the
smalltalk philosophy is to work into one ambient where
the objects live, all code is there.
Fix it implies an other layer of complexity , and I
don't want to take it.
I think is good idea to make 'automatically cast'
optional (add a new key into postgresql.conf)

Best regards
mdc

regards, tom lane

---------------------------(end of
broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Tarjeta de cr�dito Yahoo! de Banco Supervielle.
Solicit� tu nueva Tarjeta de cr�dito. De tu PC directo a tu casa. www.tuprimeratarjeta.com.ar