Thread: there is a way to deactivate type validation on 8.3.1????

there is a way to deactivate type validation on 8.3.1????

From
erobles
Date:
hi!
only for ask,  there is a way to deactivate type validation, so  i can do

select rtrim(number_field)  from table ;  with no error  and the
message: "You might need to explicit type casts"

this is postgres 8.3.1.

Re: there is a way to deactivate type validation on 8.3.1????

From
Adrian Klaver
Date:
On 05/28/2010 11:20 AM, erobles wrote:
> hi!
> only for ask, there is a way to deactivate type validation, so i can do
>
> select rtrim(number_field) from table ; with no error and the message:
> "You might need to explicit type casts"
>
> this is postgres 8.3.1.
>

What are you trying to do? I am trying to think what rtrim does on a number.

--
Adrian Klaver
adrian.klaver@gmail.com

Re: there is a way to deactivate type validation on 8.3.1????

From
Bill Moran
Date:
In response to Adrian Klaver <adrian.klaver@gmail.com>:

> On 05/28/2010 11:20 AM, erobles wrote:
> > hi!
> > only for ask, there is a way to deactivate type validation, so i can do
> >
> > select rtrim(number_field) from table ; with no error and the message:
> > "You might need to explicit type casts"
> >
> > this is postgres 8.3.1.
> >
>
> What are you trying to do? I am trying to think what rtrim does on a number.

It doesn't work on numbers, which is why he gets the "need type casts" error.

Direct answer to the question: no, there is no way to disable type validation,
it's a core feature and it wouldn't make sense.

Solution to your problem:
select rtrim(CAST(number_field AS TEXT)) from table;

Although I can't imagine why you'd be trying to trim whitespace from a
numeric field ... it will never have whitespace.

--
Bill Moran
http://www.potentialtech.com
http://people.collaborativefusion.com/~wmoran/

Re: there is a way to deactivate type validation on 8.3.1????

From
erobles
Date:

On 05/28/2010 01:26 PM, Adrian Klaver wrote:
> On 05/28/2010 11:20 AM, erobles wrote:
>> hi!
>> only for ask, there is a way to deactivate type validation, so i can do
>>
>> select rtrim(number_field) from table ; with no error and the message:
>> "You might need to explicit type casts"
>>
>> this is postgres 8.3.1.
>>
>
> What are you trying to do? I am trying to think what rtrim does on a
> number.
>


you are right, i'm trying to make a rtrim to a number.
  the reason of my question is   we have a lot of apps   with similar
querys , when  we have postgres7.2 this  kind of querys just simply
execute very well, so.. when change to  postgres 8.3   this querys fail
beacuse they needit  an explicit cast.

one solution is change the querys of apps and recompile, but time  is
short and the deadline is near.

other solution is create a function to each  explicit cast, but   we
dont have  the time to   research if there  are more   mismatch querys.

so the easy way  is deactivate the validation type ...





so  another

Re: there is a way to deactivate type validation on 8.3.1????

From
Adrian Klaver
Date:
On 05/28/2010 11:45 AM, erobles wrote:
>
>
> On 05/28/2010 01:26 PM, Adrian Klaver wrote:
>> On 05/28/2010 11:20 AM, erobles wrote:
>>> hi!
>>> only for ask, there is a way to deactivate type validation, so i can do
>>>
>>> select rtrim(number_field) from table ; with no error and the message:
>>> "You might need to explicit type casts"
>>>
>>> this is postgres 8.3.1.
>>>
>>
>> What are you trying to do? I am trying to think what rtrim does on a
>> number.
>>
>
>
> you are right, i'm trying to make a rtrim to a number.
> the reason of my question is we have a lot of apps with similar querys ,
> when we have postgres7.2 this kind of querys just simply execute very
> well, so.. when change to postgres 8.3 this querys fail beacuse they
> needit an explicit cast.
>
> one solution is change the querys of apps and recompile, but time is
> short and the deadline is near.
>
> other solution is create a function to each explicit cast, but we dont
> have the time to research if there are more mismatch querys.
>
> so the easy way is deactivate the validation type ...
>
>
>
>
>
> so another
>
For short term solution see here:
http://petereisentraut.blogspot.com/2008/03/readding-implicit-casts-in-postgresql.html


--
Adrian Klaver
adrian.klaver@gmail.com

Re: there is a way to deactivate type validation on 8.3.1????

From
erobles
Date:

On 05/28/2010 01:51 PM, Adrian Klaver wrote:
> On 05/28/2010 11:45 AM, erobles wrote:
>>
>>
>> On 05/28/2010 01:26 PM, Adrian Klaver wrote:
>>> On 05/28/2010 11:20 AM, erobles wrote:
>>>> hi!
>>>> only for ask, there is a way to deactivate type validation, so i
>>>> can do
>>>>
>>>> select rtrim(number_field) from table ; with no error and the message:
>>>> "You might need to explicit type casts"
>>>>
>>>> this is postgres 8.3.1.
>>>>
>>>
>>> What are you trying to do? I am trying to think what rtrim does on a
>>> number.
>>>
>>
>>
>> you are right, i'm trying to make a rtrim to a number.
>> the reason of my question is we have a lot of apps with similar querys ,
>> when we have postgres7.2 this kind of querys just simply execute very
>> well, so.. when change to postgres 8.3 this querys fail beacuse they
>> needit an explicit cast.
>>
>> one solution is change the querys of apps and recompile, but time is
>> short and the deadline is near.
>>
>> other solution is create a function to each explicit cast, but we dont
>> have the time to research if there are more mismatch querys.
>>
>> so the easy way is deactivate the validation type ...
>>
>>
>>
>>
>>
>> so another
>>
> For short term solution see here:
> http://petereisentraut.blogspot.com/2008/03/readding-implicit-casts-in-postgresql.html
>
>
>

thanks, downloading and testing.....

Re: there is a way to deactivate type validation on 8.3.1????

From
erobles
Date:

On 05/28/2010 02:04 PM, erobles wrote:
>
>
> On 05/28/2010 01:51 PM, Adrian Klaver wrote:
>> On 05/28/2010 11:45 AM, erobles wrote:
>>>
>>>
>>> On 05/28/2010 01:26 PM, Adrian Klaver wrote:
>>>> On 05/28/2010 11:20 AM, erobles wrote:
>>>>> hi!
>>>>> only for ask, there is a way to deactivate type validation, so i
>>>>> can do
>>>>>
>>>>> select rtrim(number_field) from table ; with no error and the
>>>>> message:
>>>>> "You might need to explicit type casts"
>>>>>
>>>>> this is postgres 8.3.1.
>>>>>
>>>>
>>>> What are you trying to do? I am trying to think what rtrim does on a
>>>> number.
>>>>
>>>
>>>
>>> you are right, i'm trying to make a rtrim to a number.
>>> the reason of my question is we have a lot of apps with similar
>>> querys ,
>>> when we have postgres7.2 this kind of querys just simply execute very
>>> well, so.. when change to postgres 8.3 this querys fail beacuse they
>>> needit an explicit cast.
>>>
>>> one solution is change the querys of apps and recompile, but time is
>>> short and the deadline is near.
>>>
>>> other solution is create a function to each explicit cast, but we dont
>>> have the time to research if there are more mismatch querys.
>>>
>>> so the easy way is deactivate the validation type ...
>>>
>>>
>>>
>>>
>>>
>>> so another
>>>
>> For short term solution see here:
>> http://petereisentraut.blogspot.com/2008/03/readding-implicit-casts-in-postgresql.html
>>
>>
>>
>
> thanks, downloading and testing.....
>

it did'nt work  :-(  , because the script is  for  pg 8.2 and i have pg
7.2 and the table  pg_cast doesn't exist.  whatever is a good idea but i
need  to know the   table or tables  on postgres 7.2.  such as  pg_cast
on postgres 8.3, to modify the script.


How can i see the 'private' tables of postgres  7.2, i tried with \d  on
template1 , if a made a select on pg_types i have a result, but i don't
know  which  is the name of the others tables  such a

Re: there is a way to deactivate type validation on 8.3.1????

From
alvherre
Date:
Excerpts from erobles's message of vie may 28 16:08:23 -0400 2010:

> it did'nt work  :-(  , because the script is  for  pg 8.2 and i have pg
> 7.2 and the table  pg_cast doesn't exist.  whatever is a good idea but i
> need  to know the   table or tables  on postgres 7.2.

Of course it didn't work if you tried to run it in 7.2; you're supposed
to run it in the 8.3 server, not the old one.  The point is to make 8.3
sort-of compatible with the old behavior.

--
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

Re: there is a way to deactivate type validation on 8.3.1????

From
erobles
Date:

On 05/28/2010 03:18 PM, alvherre wrote:
> Excerpts from erobles's message of vie may 28 16:08:23 -0400 2010:
>
>
>> it did'nt work  :-(  , because the script is  for  pg 8.2 and i have pg
>> 7.2 and the table  pg_cast doesn't exist.  whatever is a good idea but i
>> need  to know the   table or tables  on postgres 7.2.
>>
> Of course it didn't work if you tried to run it in 7.2; you're supposed
> to run it in the 8.3 server, not the old one.  The point is to make 8.3
> sort-of compatible with the old behavior.
>
>
did you see the script?

didn't  it work because the  first command is a psql  pointing a pg
server 8.2
the second command is a psql pointing a pg server 8.3
then  the command  are executed   and  get the differences
after that  made the  properly casting fucntions


this result ok , because the postgres 8.x.x have the same database
catalog.... in this case have the table pg_cast
so the query works  OK.



the problem in the postgres 7.2   doesn't exists  the table pg_cast so i
can't get the information need it to  get the differences

so, i need  modify the first command  run it and get the  info in the
same format to get it.









Re: there is a way to deactivate type validation on 8.3.1????

From
erobles
Date:

On 05/28/2010 03:34 PM, erobles wrote:
>
>
> On 05/28/2010 03:18 PM, alvherre wrote:
>> Excerpts from erobles's message of vie may 28 16:08:23 -0400 2010:
>>
>>> it did'nt work  :-(  , because the script is  for  pg 8.2 and i have pg
>>> 7.2 and the table  pg_cast doesn't exist.  whatever is a good idea
>>> but i
>>> need  to know the   table or tables  on postgres 7.2.
>> Of course it didn't work if you tried to run it in 7.2; you're supposed
>> to run it in the 8.3 server, not the old one.  The point is to make 8.3
>> sort-of compatible with the old behavior.
>>
> did you see the script?
>
> didn't  it work because the  first command is a psql  pointing a pg
> server 8.2
> the second command is a psql pointing a pg server 8.3
> then  the command  are executed   and  get the differences
> after that  made the  properly casting fucntions
>
>
> this result ok , because the postgres 8.x.x have the same database
> catalog.... in this case have the table pg_cast
> so the query works  OK.
>
>
>
> the problem in the postgres 7.2   doesn't exists  the table pg_cast so
> i can't get the information need it to  get the differences
>
> so, i need  modify the first command  run it and get the  info in the
> same format to get it.
>
>
>
>
>
>
>
>
>

i mean:

  if postgres  8.3 have a table pg_cast  and their fields  used on the
script are:
castfunc,
castsource,
casttarget,
castfunc::regprocedure,
castcontext


how can i get the same info from postgres 7.2 , and  be  able  to  get
the differences between  8.3 and 7.2


Regards.



Re: there is a way to deactivate type validation on 8.3.1????

From
Tom Lane
Date:
erobles <erobles@sensacd.com.mx> writes:
> how can i get the same info from postgres 7.2 , and  be  able  to  get
> the differences between  8.3 and 7.2

Before the pg_cast catalog there simply wasn't any explicit
representation of available casts.  I think what you need to look for is
single-argument functions that have the same name as their result type,
but it was a long time ago.

            regards, tom lane

Re: there is a way to deactivate type validation on 8.3.1????

From
Scott Marlowe
Date:
On Fri, May 28, 2010 at 2:34 PM, erobles <erobles@sensacd.com.mx> wrote:
>
>
> On 05/28/2010 03:18 PM, alvherre wrote:
>>
>> Excerpts from erobles's message of vie may 28 16:08:23 -0400 2010:
>>
>>
>>>
>>> it did'nt work  :-(  , because the script is  for  pg 8.2 and i have pg
>>> 7.2 and the table  pg_cast doesn't exist.  whatever is a good idea but i
>>> need  to know the   table or tables  on postgres 7.2.
>>>
>>
>> Of course it didn't work if you tried to run it in 7.2; you're supposed
>> to run it in the 8.3 server, not the old one.  The point is to make 8.3
>> sort-of compatible with the old behavior.
>>
>>
>
> did you see the script?
>
> didn't  it work because the  first command is a psql  pointing a pg server
> 8.2
> the second command is a psql pointing a pg server 8.3
> then  the command  are executed   and  get the differences
> after that  made the  properly casting fucntions

Couldn't you just build an 8.2 server for this one time use?

Re: there is a way to deactivate type validation on 8.3.1????

From
Adrian Klaver
Date:
On Friday 28 May 2010 1:34:24 pm erobles wrote:
> On 05/28/2010 03:18 PM, alvherre wrote:
> > Excerpts from erobles's message of vie may 28 16:08:23 -0400 2010:
> >> it did'nt work  :-(  , because the script is  for  pg 8.2 and i have pg
> >> 7.2 and the table  pg_cast doesn't exist.  whatever is a good idea but i
> >> need  to know the   table or tables  on postgres 7.2.
> >
> > Of course it didn't work if you tried to run it in 7.2; you're supposed
> > to run it in the 8.3 server, not the old one.  The point is to make 8.3
> > sort-of compatible with the old behavior.
>
> did you see the script?
>
> didn't  it work because the  first command is a psql  pointing a pg
> server 8.2
> the second command is a psql pointing a pg server 8.3
> then  the command  are executed   and  get the differences
> after that  made the  properly casting fucntions
>
>
> this result ok , because the postgres 8.x.x have the same database
> catalog.... in this case have the table pg_cast
> so the query works  OK.
>
>
>
> the problem in the postgres 7.2   doesn't exists  the table pg_cast so i
> can't get the information need it to  get the differences
>
> so, i need  modify the first command  run it and get the  info in the
> same format to get it.

I believe you are looking at the wrong file; the shell script. Try instead the
other link http://wiki.postgresql.org/wiki/Image:Pg83-implicit-casts.sql It
contains the functions you need.

--
Adrian Klaver
adrian.klaver@gmail.com

Re: there is a way to deactivate type validation on 8.3.1????

From
erobles
Date:

On 05/28/2010 04:58 PM, Adrian Klaver wrote:
> On Friday 28 May 2010 1:34:24 pm erobles wrote:
>
>> On 05/28/2010 03:18 PM, alvherre wrote:
>>
>>> Excerpts from erobles's message of vie may 28 16:08:23 -0400 2010:
>>>
>>>> it did'nt work  :-(  , because the script is  for  pg 8.2 and i have pg
>>>> 7.2 and the table  pg_cast doesn't exist.  whatever is a good idea but i
>>>> need  to know the   table or tables  on postgres 7.2.
>>>>
>>> Of course it didn't work if you tried to run it in 7.2; you're supposed
>>> to run it in the 8.3 server, not the old one.  The point is to make 8.3
>>> sort-of compatible with the old behavior.
>>>
>> did you see the script?
>>
>> didn't  it work because the  first command is a psql  pointing a pg
>> server 8.2
>> the second command is a psql pointing a pg server 8.3
>> then  the command  are executed   and  get the differences
>> after that  made the  properly casting fucntions
>>
>>
>> this result ok , because the postgres 8.x.x have the same database
>> catalog.... in this case have the table pg_cast
>> so the query works  OK.
>>
>>
>>
>> the problem in the postgres 7.2   doesn't exists  the table pg_cast so i
>> can't get the information need it to  get the differences
>>
>> so, i need  modify the first command  run it and get the  info in the
>> same format to get it.
>>
> I believe you are looking at the wrong file; the shell script. Try instead the
> other link http://wiki.postgresql.org/wiki/Image:Pg83-implicit-casts.sql It
> contains the functions you need.
>
>
thanks!