pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Inoue, Hiroshi <h-inoue@dream.email.ne.jp>
To: fabriziomello@gmail.com
Cc: pgsql-odbc@lists.postgresql.org
Subject: Re: Wrong column size using MIN/MAX without return result
Date: Tue, 25 Sep 2018 12:12:30 +0900
Message-ID: <d6fec2c3-7934-c5da-a167-0bf8482dad8a@dream.email.ne.jp> (raw)
In-Reply-To: <CAFcNs+o499EnwGaFBzeNHAyPrjQ7QdJVudE34TtnaLMT_2HAyw@mail.gmail.com>
References: <CAFcNs+o499EnwGaFBzeNHAyPrjQ7QdJVudE34TtnaLMT_2HAyw@mail.gmail.com>

Hi,


On 2018/09/24 23:49, Fabrízio de Royes Mello wrote:
> Hi all,
>
> We've experiencing an issue using the driver version 10.03.0000 under 
> unixODBC 2.3.1 environment.
>
> When we use MIN/MAX functions in a query returning CHAR without 
> results,  the column size is wrong. Seems if we use any function that 
> return "text types" without returning tuples the column size is wrong.

SQL returns NULL for MIN/MAX functions without results.

regards,
Hiroshi Inoue

>
> Below there are some self contained testcases:
>
> ** SQL testcase 1 (ERROR):
>
> SQL> DROP TABLE IF EXISTS T1;
> SQL> CREATE TABLE T1 ( FLD char(10) NOT NULL DEFAULT '         ' );
> SQL> INSERT INTO T1 VALUES('1');
> SQL> INSERT INTO T1 VALUES('22');
> SQL> INSERT INTO T1 VALUES('333');
> SQL> SELECT MAX(FLD) AS OK FROM T1;
> +-----------+
> | ok        |
> +-----------+
> | 333       |
> +-----------+
> SQLRowCount returns 1
> 1 rows fetched
> SQL> SELECT MAX(FLD) AS ERROR FROM T1 WHERE 1 = 0;
> +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
> | error |
> +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
> | |
> +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
> SQLRowCount returns 1
> 1 rows fetched
>
>
> ** SQL testcase 2 (ERROR):
> SQL> DROP TABLE IF EXISTS T1;
> SQL> CREATE TABLE T1 ( FLD char(10) NOT NULL DEFAULT '         ' );
> SQL> INSERT INTO T1 VALUES('1');
> SQL> INSERT INTO T1 VALUES('22');
> SQL> INSERT INTO T1 VALUES('333');
> SQL> SELECT SUBSTR(FLD,1,5) AS OK FROM T1 WHERE FLD = '333';
> +----+
> | ok |
> +----+
> | 333|
> +----+
> SQLRowCount returns 1
> 1 rows fetched
> SQL> SELECT SUBSTR(FLD,1,5) AS ERROR FROM T1 WHERE 1 = 0;
> +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
> | error      |
> +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
> +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
> SQLRowCount returns 0
>
>
> ** SQL testcase 3 (OK):
> SQL> DROP TABLE IF EXISTS T1;
> SQL> CREATE TABLE T1 ( FLD char(10) NOT NULL DEFAULT '         ' );
> SQL> INSERT INTO T1 VALUES('1');
> SQL> INSERT INTO T1 VALUES('22');
> SQL> INSERT INTO T1 VALUES('333');
> SQL> SELECT FLD AS OK FROM T1 WHERE FLD = '333';
> +-----------+
> | ok        |
> +-----------+
> | 333       |
> +-----------+
> SQLRowCount returns 1
> 1 rows fetched
> SQL> SELECT FLD AS ERROR FROM T1 WHERE 1 = 0;
> +-----------+
> | error     |
> +-----------+
> +-----------+
> SQLRowCount returns 0
>
> There are some config to fix this weird behaviour?
>
> Regards,
>
> -- 
>    Fabrízio de Royes Mello       Timbira - http://www.timbira.com.br/
>    PostgreSQL: Consultoria, Desenvolvimento, Suporte 24x7 e Treinamento

view thread (3+ messages)  latest in thread

Message-ID: <d6fec2c3-7934-c5da-a167-0bf8482dad8a@dream.email.ne.jp>
Permalink:  ../d6fec2c3-7934-c5da-a167-0bf8482dad8a@dream.email.ne.jp/
Also on:    postgresql.org/message-id/d6fec2c3-7934-c5da-a167-0bf8482dad8a@dream.email.ne.jp

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-odbc@postgresql.org
  Cc: h-inoue@dream.email.ne.jp, fabriziomello@gmail.com
  Subject: Re: Wrong column size using MIN/MAX without return result
  In-Reply-To: <d6fec2c3-7934-c5da-a167-0bf8482dad8a@dream.email.ne.jp>
  References: <CAFcNs+o499EnwGaFBzeNHAyPrjQ7QdJVudE34TtnaLMT_2HAyw@mail.gmail.com> <d6fec2c3-7934-c5da-a167-0bf8482dad8a@dream.email.ne.jp>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox