Thread: Bug

Bug

From
Thiago Braga Nobre
Date:
Hi
why in version 8.4.4 I have to do is cast in the previous version of PHP itself postgres already identified this conversion?
thank you
 
Happy new year,

Thiago Braga Nobre

Re: Bug

From
Scott Marlowe
Date:
On Tue, Jan 3, 2012 at 9:47 AM, Thiago Braga Nobre
<thiagobraganobre@gmail.com> wrote:
> Hi
> why in version 8.4.4 I have to do is cast in the previous version of PHP
> itself postgres already identified this conversion?
> thank you

Are you referring to the absence of automatic type conversion on
postgresql that started with version 8.3?  I'm not sure what you're
asking exactly.

Re: Bug

From
Thiago Braga Nobre
Date:
that's right 


2012/1/3 Scott Marlowe <scott.marlowe@gmail.com>
On Tue, Jan 3, 2012 at 9:47 AM, Thiago Braga Nobre
<thiagobraganobre@gmail.com> wrote:
> Hi
> why in version 8.4.4 I have to do is cast in the previous version of PHP
> itself postgres already identified this conversion?
> thank you

Are you referring to the absence of automatic type conversion on
postgresql that started with version 8.3?  I'm not sure what you're
asking exactly.



--
Atenciosamente,

Thiago Braga Nobre
(21) 8527-9400

Re: Bug

From
Scott Marlowe
Date:
It was considered a bug when things were automagically cast before,
it's considered fixed now.  What's your query and table defs look
like?

On Tue, Jan 3, 2012 at 2:57 PM, Thiago Braga Nobre
<thiagobraganobre@gmail.com> wrote:
> that's right
>
>
> 2012/1/3 Scott Marlowe <scott.marlowe@gmail.com>
>>
>> On Tue, Jan 3, 2012 at 9:47 AM, Thiago Braga Nobre
>> <thiagobraganobre@gmail.com> wrote:
>> > Hi
>> > why in version 8.4.4 I have to do is cast in the previous version of PHP
>> > itself postgres already identified this conversion?
>> > thank you
>>
>> Are you referring to the absence of automatic type conversion on
>> postgresql that started with version 8.3?  I'm not sure what you're
>> asking exactly.
>
>
>
>
> --
> Atenciosamente,
>
> Thiago Braga Nobre
> (21) 8527-9400
>
> http://br.linkedin.com/pub/thiago-braga-nobre/25/577/a08
>
> http://twitter.com/thiago_b_nobre
>
> thiagobraganobre@gmail.com
>
>
>
>



--
To understand recursion, one must first understand recursion.

Re: Bug

From
Scott Marlowe
Date:
No it was broken before, because you didn't know if what you were
comparing was what it meant.  for instance:

where number='01000';

should we cast the number to text, or the text to numeric?

On Tue, Jan 3, 2012 at 3:44 PM, Thiago Braga Nobre
<thiagobraganobre@gmail.com> wrote:
> was better before, thanks and happy 2012
>
>
>
> 2012/1/3 Scott Marlowe <scott.marlowe@gmail.com>
>>
>> It was considered a bug when things were automagically cast before,
>> it's considered fixed now.  What's your query and table defs look
>> like?
>>
>> On Tue, Jan 3, 2012 at 2:57 PM, Thiago Braga Nobre
>> <thiagobraganobre@gmail.com> wrote:
>> > that's right
>> >
>> >
>> > 2012/1/3 Scott Marlowe <scott.marlowe@gmail.com>
>> >>
>> >> On Tue, Jan 3, 2012 at 9:47 AM, Thiago Braga Nobre
>> >> <thiagobraganobre@gmail.com> wrote:
>> >> > Hi
>> >> > why in version 8.4.4 I have to do is cast in the previous version of
>> >> > PHP
>> >> > itself postgres already identified this conversion?
>> >> > thank you
>> >>
>> >> Are you referring to the absence of automatic type conversion on
>> >> postgresql that started with version 8.3?  I'm not sure what you're
>> >> asking exactly.
>> >
>> >
>> >
>> >
>> > --
>> > Atenciosamente,
>> >
>> > Thiago Braga Nobre
>> > (21) 8527-9400
>> >
>> > http://br.linkedin.com/pub/thiago-braga-nobre/25/577/a08
>> >
>> > http://twitter.com/thiago_b_nobre
>> >
>> > thiagobraganobre@gmail.com
>> >
>> >
>> >
>> >
>>
>>
>>
>> --
>> To understand recursion, one must first understand recursion.
>
>
>
>
> --
> Atenciosamente,
>
> Thiago Braga Nobre
> (21) 8527-9400
>
> http://br.linkedin.com/pub/thiago-braga-nobre/25/577/a08
>
> http://twitter.com/thiago_b_nobre
>
> thiagobraganobre@gmail.com
>
>
>
>



--
To understand recursion, one must first understand recursion.

Re: Bug

From
Thiago Braga Nobre
Date:
was better before, thanks and happy 2012 


2012/1/3 Scott Marlowe <scott.marlowe@gmail.com>
It was considered a bug when things were automagically cast before,
it's considered fixed now.  What's your query and table defs look
like?

On Tue, Jan 3, 2012 at 2:57 PM, Thiago Braga Nobre
<thiagobraganobre@gmail.com> wrote:
> that's right
>
>
> 2012/1/3 Scott Marlowe <scott.marlowe@gmail.com>
>>
>> On Tue, Jan 3, 2012 at 9:47 AM, Thiago Braga Nobre
>> <thiagobraganobre@gmail.com> wrote:
>> > Hi
>> > why in version 8.4.4 I have to do is cast in the previous version of PHP
>> > itself postgres already identified this conversion?
>> > thank you
>>
>> Are you referring to the absence of automatic type conversion on
>> postgresql that started with version 8.3?  I'm not sure what you're
>> asking exactly.
>
>
>
>
> --
> Atenciosamente,
>
> Thiago Braga Nobre
> (21) 8527-9400
>
> http://br.linkedin.com/pub/thiago-braga-nobre/25/577/a08
>
> http://twitter.com/thiago_b_nobre
>
> thiagobraganobre@gmail.com
>
>
>
>



--
To understand recursion, one must first understand recursion.



--
Atenciosamente,

Thiago Braga Nobre
(21) 8527-9400

Re: Bug

From
Scott Marlowe
Date:
But if one is a numeric and one is a text, which do you convert?
There's lots of conversations on this in the lists from about 4 or 5
years ago.  Since converting one way or the other can cause two
different outputs, you can't be sure which is the right way.  If you
need a field cast, you now have to cast it yourself for safety.

On Tue, Jan 3, 2012 at 4:56 PM, Thiago Braga Nobre
<thiagobraganobre@gmail.com> wrote:
> what is the typing table field? If the type is numeric you convert
> to number, if the type is varchar to string, it is very obvious, is not it?
>
>
> 2012/1/3 Scott Marlowe <scott.marlowe@gmail.com>
>>
>> No it was broken before, because you didn't know if what you were
>> comparing was what it meant.  for instance:
>>
>> where number='01000';
>>
>> should we cast the number to text, or the text to numeric?
>>
>> On Tue, Jan 3, 2012 at 3:44 PM, Thiago Braga Nobre
>> <thiagobraganobre@gmail.com> wrote:
>> > was better before, thanks and happy 2012
>> >
>> >
>> >
>> > 2012/1/3 Scott Marlowe <scott.marlowe@gmail.com>
>> >>
>> >> It was considered a bug when things were automagically cast before,
>> >> it's considered fixed now.  What's your query and table defs look
>> >> like?
>> >>
>> >> On Tue, Jan 3, 2012 at 2:57 PM, Thiago Braga Nobre
>> >> <thiagobraganobre@gmail.com> wrote:
>> >> > that's right
>> >> >
>> >> >
>> >> > 2012/1/3 Scott Marlowe <scott.marlowe@gmail.com>
>> >> >>
>> >> >> On Tue, Jan 3, 2012 at 9:47 AM, Thiago Braga Nobre
>> >> >> <thiagobraganobre@gmail.com> wrote:
>> >> >> > Hi
>> >> >> > why in version 8.4.4 I have to do is cast in the previous version
>> >> >> > of
>> >> >> > PHP
>> >> >> > itself postgres already identified this conversion?
>> >> >> > thank you
>> >> >>
>> >> >> Are you referring to the absence of automatic type conversion on
>> >> >> postgresql that started with version 8.3?  I'm not sure what you're
>> >> >> asking exactly.
>> >> >
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> > Atenciosamente,
>> >> >
>> >> > Thiago Braga Nobre
>> >> > (21) 8527-9400
>> >> >
>> >> > http://br.linkedin.com/pub/thiago-braga-nobre/25/577/a08
>> >> >
>> >> > http://twitter.com/thiago_b_nobre
>> >> >
>> >> > thiagobraganobre@gmail.com
>> >> >
>> >> >
>> >> >
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> To understand recursion, one must first understand recursion.
>> >
>> >
>> >
>> >
>> > --
>> > Atenciosamente,
>> >
>> > Thiago Braga Nobre
>> > (21) 8527-9400
>> >
>> > http://br.linkedin.com/pub/thiago-braga-nobre/25/577/a08
>> >
>> > http://twitter.com/thiago_b_nobre
>> >
>> > thiagobraganobre@gmail.com
>> >
>> >
>> >
>> >
>>
>>
>>
>> --
>> To understand recursion, one must first understand recursion.
>
>
>
>
> --
> Atenciosamente,
>
> Thiago Braga Nobre
> (21) 8527-9400
>
> http://br.linkedin.com/pub/thiago-braga-nobre/25/577/a08
>
> http://twitter.com/thiago_b_nobre
>
> thiagobraganobre@gmail.com
>
>
>
>



--
To understand recursion, one must first understand recursion.

Re: Bug

From
Thiago Braga Nobre
Date:
A practical example is the scheme substring (text, integer, integer), if I step substring (row ['name'], start, end) but for some reason they start and end string causes an exception, thesubstring function should not perform the conversion from string to integer? 

thanks a lot


2012/1/3 Scott Marlowe <scott.marlowe@gmail.com>
But if one is a numeric and one is a text, which do you convert?
There's lots of conversations on this in the lists from about 4 or 5
years ago.  Since converting one way or the other can cause two
different outputs, you can't be sure which is the right way.  If you
need a field cast, you now have to cast it yourself for safety.

On Tue, Jan 3, 2012 at 4:56 PM, Thiago Braga Nobre
<thiagobraganobre@gmail.com> wrote:
> what is the typing table field? If the type is numeric you convert
> to number, if the type is varchar to string, it is very obvious, is not it?
>
>
> 2012/1/3 Scott Marlowe <scott.marlowe@gmail.com>
>>
>> No it was broken before, because you didn't know if what you were
>> comparing was what it meant.  for instance:
>>
>> where number='01000';
>>
>> should we cast the number to text, or the text to numeric?
>>
>> On Tue, Jan 3, 2012 at 3:44 PM, Thiago Braga Nobre
>> <thiagobraganobre@gmail.com> wrote:
>> > was better before, thanks and happy 2012
>> >
>> >
>> >
>> > 2012/1/3 Scott Marlowe <scott.marlowe@gmail.com>
>> >>
>> >> It was considered a bug when things were automagically cast before,
>> >> it's considered fixed now.  What's your query and table defs look
>> >> like?
>> >>
>> >> On Tue, Jan 3, 2012 at 2:57 PM, Thiago Braga Nobre
>> >> <thiagobraganobre@gmail.com> wrote:
>> >> > that's right
>> >> >
>> >> >
>> >> > 2012/1/3 Scott Marlowe <scott.marlowe@gmail.com>
>> >> >>
>> >> >> On Tue, Jan 3, 2012 at 9:47 AM, Thiago Braga Nobre
>> >> >> <thiagobraganobre@gmail.com> wrote:
>> >> >> > Hi
>> >> >> > why in version 8.4.4 I have to do is cast in the previous version
>> >> >> > of
>> >> >> > PHP
>> >> >> > itself postgres already identified this conversion?
>> >> >> > thank you
>> >> >>
>> >> >> Are you referring to the absence of automatic type conversion on
>> >> >> postgresql that started with version 8.3?  I'm not sure what you're
>> >> >> asking exactly.
>> >> >
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> > Atenciosamente,
>> >> >
>> >> > Thiago Braga Nobre
>> >> > (21) 8527-9400
>> >> >
>> >> > http://br.linkedin.com/pub/thiago-braga-nobre/25/577/a08
>> >> >
>> >> > http://twitter.com/thiago_b_nobre
>> >> >
>> >> > thiagobraganobre@gmail.com
>> >> >
>> >> >
>> >> >
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> To understand recursion, one must first understand recursion.
>> >
>> >
>> >
>> >
>> > --
>> > Atenciosamente,
>> >
>> > Thiago Braga Nobre
>> > (21) 8527-9400
>> >
>> > http://br.linkedin.com/pub/thiago-braga-nobre/25/577/a08
>> >
>> > http://twitter.com/thiago_b_nobre
>> >
>> > thiagobraganobre@gmail.com
>> >
>> >
>> >
>> >
>>
>>
>>
>> --
>> To understand recursion, one must first understand recursion.
>
>
>
>
> --
> Atenciosamente,
>
> Thiago Braga Nobre
> (21) 8527-9400
>
> http://br.linkedin.com/pub/thiago-braga-nobre/25/577/a08
>
> http://twitter.com/thiago_b_nobre
>
> thiagobraganobre@gmail.com
>
>
>
>



--
To understand recursion, one must first understand recursion.



--
Atenciosamente,

Thiago Braga Nobre
(21) 8527-9400

Re: Bug

From
Thiago Braga Nobre
Date:
what is the typing table field? If the type is numeric you convert to number, if the type is varchar to string, it is very obvious, is not it? 


2012/1/3 Scott Marlowe <scott.marlowe@gmail.com>
No it was broken before, because you didn't know if what you were
comparing was what it meant.  for instance:

where number='01000';

should we cast the number to text, or the text to numeric?

On Tue, Jan 3, 2012 at 3:44 PM, Thiago Braga Nobre
<thiagobraganobre@gmail.com> wrote:
> was better before, thanks and happy 2012
>
>
>
> 2012/1/3 Scott Marlowe <scott.marlowe@gmail.com>
>>
>> It was considered a bug when things were automagically cast before,
>> it's considered fixed now.  What's your query and table defs look
>> like?
>>
>> On Tue, Jan 3, 2012 at 2:57 PM, Thiago Braga Nobre
>> <thiagobraganobre@gmail.com> wrote:
>> > that's right
>> >
>> >
>> > 2012/1/3 Scott Marlowe <scott.marlowe@gmail.com>
>> >>
>> >> On Tue, Jan 3, 2012 at 9:47 AM, Thiago Braga Nobre
>> >> <thiagobraganobre@gmail.com> wrote:
>> >> > Hi
>> >> > why in version 8.4.4 I have to do is cast in the previous version of
>> >> > PHP
>> >> > itself postgres already identified this conversion?
>> >> > thank you
>> >>
>> >> Are you referring to the absence of automatic type conversion on
>> >> postgresql that started with version 8.3?  I'm not sure what you're
>> >> asking exactly.
>> >
>> >
>> >
>> >
>> > --
>> > Atenciosamente,
>> >
>> > Thiago Braga Nobre
>> > (21) 8527-9400
>> >
>> > http://br.linkedin.com/pub/thiago-braga-nobre/25/577/a08
>> >
>> > http://twitter.com/thiago_b_nobre
>> >
>> > thiagobraganobre@gmail.com
>> >
>> >
>> >
>> >
>>
>>
>>
>> --
>> To understand recursion, one must first understand recursion.
>
>
>
>
> --
> Atenciosamente,
>
> Thiago Braga Nobre
> (21) 8527-9400
>
> http://br.linkedin.com/pub/thiago-braga-nobre/25/577/a08
>
> http://twitter.com/thiago_b_nobre
>
> thiagobraganobre@gmail.com
>
>
>
>



--
To understand recursion, one must first understand recursion.



--
Atenciosamente,

Thiago Braga Nobre
(21) 8527-9400

Re: Bug

From
Robert Haas
Date:
On Tue, Jan 3, 2012 at 7:40 PM, Thiago Braga Nobre
<thiagobraganobre@gmail.com> wrote:
> A practical example is the scheme substring (text, integer, integer), if
> I step substring (row ['name'], start, end) but for some reason they start
> and end string causes an exception, thesubstring function should not perform
> the conversion from string to integer?

Eh... maybe the other way around?

It has long bothered me that, beginning in 8.3, we can't figure out
that substring(123456, 2, 2) isn't intended to cast 123456 to text.
There just aren't that many other sensible things for that to mean.
It's not exactly clear what to do about it, though, since as far as
the backend knows we could have intended to call substring(bit,
integer, integer) or substring(bytea, integer, integer) rather than
substring(text, integer, integer).  How do we make a principled
decision to prefer text?  I don't know, but I wish we had a way.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Re: Bug

From
Thiago Braga Nobre
Date:
In this case if the function takes the string parameter, whatever the value provided, but it should be converted to string using aconversion, ie, substring (123456, 2, 2), would be converted tosubstring ("123456" 2, 2), the postgreSQL hospital should make this process as we work often with legacy systems and these are aperfect pasta, sometimes a seemingly simple change could destabilize the entire system.

Another thing I find bad is that in PostgreSQL to perform a selectof all records and it does not allow the order by only one column.

Thanks for the support and attention 

2012/1/27 Robert Haas <robertmhaas@gmail.com>
On Tue, Jan 3, 2012 at 7:40 PM, Thiago Braga Nobre
<thiagobraganobre@gmail.com> wrote:
> A practical example is the scheme substring (text, integer, integer), if
> I step substring (row ['name'], start, end) but for some reason they start
> and end string causes an exception, thesubstring function should not perform
> the conversion from string to integer?

Eh... maybe the other way around?

It has long bothered me that, beginning in 8.3, we can't figure out
that substring(123456, 2, 2) isn't intended to cast 123456 to text.
There just aren't that many other sensible things for that to mean.
It's not exactly clear what to do about it, though, since as far as
the backend knows we could have intended to call substring(bit,
integer, integer) or substring(bytea, integer, integer) rather than
substring(text, integer, integer).  How do we make a principled
decision to prefer text?  I don't know, but I wish we had a way.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



--
Atenciosamente,

Thiago Braga Nobre
(21) 8527-9400