Re: day interval

2019-10-12 Thread Tom Lane
Andrew Gierth writes: > "Abraham" == Abraham, Danny writes: > Abraham> The problem is still this: > Abraham> select date('20191001') - date('20190101') ; > Abraham> in my servers it is always '273'. > Abraham> In the customer's DB it is '273 days'; > Then you need to establish why that is.

Re: SELECT d02name::bytea FROM ... && DBI::Pg

2019-10-12 Thread Andrew Gierth
> "Matthias" == Matthias Apitz writes: Matthias> Hello, Matthias> I can SELECT && print a column in hex with: Matthias> pos71=# select d02name::bytea from d02ben where d02bnr = '1048313' ; If your intention is to see the raw bytes of the stored text value, for example to check the

Re: day interval

2019-10-12 Thread Andrew Gierth
> "Abraham" == Abraham, Danny writes: Abraham> Thanks for the clarification. Abraham> The problem is still this: Abraham> select date('20191001') - date('20190101') ; Abraham> in my servers it is always '273'. Abraham> In the customer's DB it is '273 days'; Then you need to establish

Re: day interval

2019-10-12 Thread Adrian Klaver
On 10/12/19 9:34 AM, Abraham, Danny wrote: The problematic code is: select date(cm_curr_date) - date(CM_DATE) into diff_days from CMS_SYSPRM; The fix is: select date_part ('day', age( date(cm_curr_date), date(CM_DATE))) into diff_days from CMS_SYSPRM; The problem: How to recreate the

RE: Re: day interval

2019-10-12 Thread Abraham, Danny
Thanks for the clarification. The problem is still this: select date('20191001') - date('20190101') ; in my servers it is always '273'. In the customer's DB it is '273 days'; Thanks Danny -Original Message- From: Andrew Gierth Sent: Saturday, October 12, 2019 7:53 PM To: Abraham,

Re: day interval

2019-10-12 Thread Adrian Klaver
On 10/12/19 8:37 AM, Abraham, Danny wrote: Thanks Andrew. My code fails since the expression (In a PG/PG SQL function) which assumes integer result Now produces the string '8 day'; The code is? This has been working for years on all PG community servers. This happens on an EDB PG 9.6.3.

Re: day interval

2019-10-12 Thread Ron
Date subtraction returns the integer data type; timestamp subtraction returns the interval datatype. postgres@haggis:~$ psql test psql (9.6.15) Type "help" for help. test=# select date('20191001') - date('20190923');  ?column? --     8 (1 row) test=# select date('2019-10-01') -

RE: Re: day interval

2019-10-12 Thread Abraham, Danny
Thanks Andrew. My code fails since the expression (In a PG/PG SQL function) which assumes integer result Now produces the string '8 day'; This has been working for years on all PG community servers. This happens on an EDB PG 9.6.3. I know the fix, but I need the ability to create the bug in

Re: day interval

2019-10-12 Thread Andrew Gierth
> "Abraham" == Abraham, Danny writes: Abraham> Hi Abraham> A question on day interval Abraham> select date('20191001') - date('20190923'); Abraham> Will provide sometimes '8' - an integer , but sometimes '8 Abraham> day' - a string No, it'll always return an integer. You will only

day interval

2019-10-12 Thread Abraham, Danny
Hi A question on day interval select date('20191001') - date('20190923'); Will provide sometimes '8' - an integer , but sometimes '8 day' - a string How can I control it to return integer always? Thanks Danny

Re: Perl DBI converts UTF-8 again to UTF-8 before sending it to the server

2019-10-12 Thread Daniel Verite
Christoph Moench-Tegeder wrote: > And then it doesn't know that your terminal expects UTF-8 (perl > just dumps the binary string here), because you didn't tell it: > "binmode(STDOUT, ':encoding(utf8)')" would fix that. Or use perl -C, so that it gets that from the environment. From

Re: SELECT d02name::bytea FROM ... && DBI::Pg

2019-10-12 Thread Christoph Moench-Tegeder
## Matthias Apitz (g...@unixarea.de): > Hmm. But *I* do need the content in hex to see if the varchar column > contains correct encoded UTF-8 data. select 'Hello'::bytea::text; Regards, Christoph -- Spare Space

Re: Case Insensitive Comparison with Postgres 12

2019-10-12 Thread Daniel Verite
Igal Sapir wrote: > > Out of curiosity is there a eason not to use the citext type for th? > > > > > Using the collation seems like a much cleaner approach, and I trust ICU to > do a better job at comparing strings according to language rules etc. One notable difference between citext

Re: Perl DBI converts UTF-8 again to UTF-8 before sending it to the server

2019-10-12 Thread Christoph Moench-Tegeder
## Matthias Apitz (g...@unixarea.de): > but when I now fetch the first row with: > >@row = $sth->fetchrow_array; >$HexStr = unpack("H*", $row[0]); >print "HexStr: " . $HexStr . "\n"; >print "$row[0]\n"; > > The resulting column contains ISO data: As expected:

Re: Segmentation fault with PG-12

2019-10-12 Thread Andreas Joseph Krogh
På torsdag 10. oktober 2019 kl. 22:21:13, skrev Andres Freund < and...@anarazel.de >: On 2019-10-10 15:32:38 -0400, Tom Lane wrote: > Andres Freund writes: > > On 2019-10-09 10:16:37 -0400, Tom Lane wrote: > >> Well, it shows that the failure is occurring while

Re: SELECT d02name::bytea FROM ... && DBI::Pg

2019-10-12 Thread Francisco Olarte
Matthias: On Thu, Oct 10, 2019 at 7:26 PM Matthias Apitz wrote: > Hmm. But *I* do need the content in hex to see if the varchar column > contains correct encoded UTF-8 data. We're on the way to port a huge > database application from Sybase to PostgreSQL and are facing any kind of > problems