Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e9AB2-0007J9-2c for pgsql-odbc@arkaria.postgresql.org; Mon, 30 Oct 2017 13:32:28 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1e9AB1-0000Zv-Jn for pgsql-odbc@arkaria.postgresql.org; Mon, 30 Oct 2017 13:32:27 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1e9AAd-0008Le-Mb for pgsql-odbc@postgresql.org; Mon, 30 Oct 2017 13:32:03 +0000 Received: from yello.ksf.kiev.ua ([212.40.47.11]) by makus.postgresql.org with esmtps (TLS1.0:DHE_RSA_CAMELLIA_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1e9AAU-0007OB-H2 for pgsql-odbc@postgresql.org; Mon, 30 Oct 2017 13:32:02 +0000 X-Virus-Scanned: amavisd-new at ksf.kiev.ua X-Amavis-OS-Fingerprint: MYNETWORKS, [192.168.168.206:] Received: from Tokyo (tokyo.ksf [192.168.168.206]) (authenticated bits=0) by yello.ksf.kiev.ua (8.13.8/8.13.8) with ESMTP id v9UDUmgW076899 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 30 Oct 2017 15:30:48 +0200 (EET) (envelope-from gpruss@ksf.kiev.ua) From: "Georgy Pruss" To: "'Inoue, Hiroshi'" Cc: References: <001301d3427d$e75774d0$b6065e70$@ksf.kiev.ua> <0ae50a45-159e-2552-2b4b-7abee1ef64db@dream.email.ne.jp> In-Reply-To: Subject: Re: error with $ in names again Date: Mon, 30 Oct 2017 15:31:32 +0200 Message-ID: <00a401d35183$6da80590$48f810b0$@ksf.kiev.ua> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_00A5_01D35194.313912F0" X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQJNgPl6wJ+1OYRtBgtJpOziixvpowI6KDzfAl1qdreh40fS0A== Content-Language: en-us X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.3 (yello.ksf.kiev.ua [212.40.47.11]); Mon, 30 Oct 2017 15:30:55 +0200 (EET) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-odbc Precedence: bulk Sender: pgsql-odbc-owner@postgresql.org This is a multipart message in MIME format. ------=_NextPart_000_00A5_01D35194.313912F0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hi, Any news on new driver for 9.6 on Linux? I guess everybody must be busy with 10.0, but still, maybe some = progress=E2=80=A6 Thank you! G.P. =20 =20 From: Inoue, Hiroshi [mailto:h-inoue@dream.email.ne.jp]=20 Sent: Friday, October 13, 2017 16:52 To: Georgy Pruss Cc: pgsql-odbc@postgresql.org Subject: Re: [ODBC] error with $ in names again =20 Hi Georgy, On 2017/10/11 23:08, Inoue, Hiroshi wrote: Hi Gregory, On 2017/10/11 19:44, Georgy Pruss wrote: Hi, =20 I think there=E2=80=99s still a bug in parsing names with dollars. Linux RHEL66 =20 UseServerSidePrepare=3D0: =20 create table T$001 (=E2=80=A6) ok=20 create table T_$001 (=E2=80=A6) ok=20 =20 UseServerSidePrepare=3D1: =20 create table T$001 (=E2=80=A6) ok=20 create table T_$001 (=E2=80=A6) error Thanks for the report. I would examine the issue. I found a cause and committed the fix to git. We would make a new release soon. regards, Hiroshi Inoue regards, Hiroshi Inoue =20 Here is session log for that: =20 $ test_odbc 0 'T$001' Connection: DSN=3DPGDriver;UseServerSidePrepare=3D0 Returned connection string was: = =E2=80=A6;UseDeclareFetch=3D0;=E2=80=A6;Parse=3D0;=E2=80=A6;UseServerSide= Prepare=3D1;LowerCaseIdentifier=3D0; Exec: create table T$001 (i integer) ok =20 $ test_odbc 1 'T$001' Connection: DSN=3DPGDriver;UseServerSidePrepare=3D1 Returned connection string was: =E2=80=A6 Exec: create table T$001 (i integer) ok =20 $ test_odbc 0 'T_$001' Connection: DSN=3DPGDriver;UseServerSidePrepare=3D0 Returned connection string was: =E2=80=A6 Exec: create table T_$001 (i integer) ok =20 $ test_odbc 1 'T_$001' Connection: DSN=3DPGDriver;UseServerSidePrepare=3D1 Returned connection string was: =E2=80=A6 Exec: create table T_$001 (i integer) Error =20 ODBC error: "Parameters exist but IPD isn't set. Please call = SQLDescribeParam()" =20 I guess $n parameters should not be allowed/treated in any ODBC = statements except PREPARE/EXECUTE at all, right? In ODBC statements (and in any case not in table names) it=E2=80=99s = =E2=80=98?=E2=80=99, right? (I know, internally =E2=80=98?=E2=80=99 are replaced by = =E2=80=98$n=E2=80=99, maybe it=E2=80=99s too much for pure = =E2=80=98$=E2=80=99 sign =E2=80=93 literal strings, parameters for = PREPARE, internal parameters for ODBC=E2=80=A6) =20 - - - - - - - - - - - - - - - - - - - - - - - - - - - - =20 $ cat test_odbc.c // gcc -I unixODBC-2.3.4/include -I unixODBC-2.3.4 -L libs -lodbc = test_odbc.c -o test_odbc // test_odbc 0|1 'tablename' =20 #include #include #include #include =20 int main(int ac, char* av[]) { SQLHENV env; SQLHDBC dbc; SQLRETURN ret; SQLCHAR outstr[1024]; SQLSMALLINT outstrlen; SQLHSTMT stmt; if( ac!=3D3 || av[1][1]!=3D'\0' || !(av[1][0]=3D=3D'0' || = av[1][0]=3D=3D'1') ) return printf( "Syntax: test_odbc 0|1 'tablename'\n" ), 1; SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env); SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, (void*)SQL_OV_ODBC3, 0); SQLAllocHandle(SQL_HANDLE_DBC, env, &dbc); char conn[512]; sprintf( conn, "DSN=3DPGDriver;UseServerSidePrepare=3D%s", av[1] ); printf( "Connection: %s\n", conn ); ret =3D SQLDriverConnect(dbc, NULL, conn, SQL_NTS, outstr, sizeof(outstr), &outstrlen, SQL_DRIVER_COMPLETE); if(!SQL_SUCCEEDED(ret)) { fprintf(stderr, "Failed to connect\n"); } else { printf("Returned connection string was:\n\t%s\n", outstr); char sql[512]; sprintf( sql, "create table %s (i integer)", av[2] ); // = <------------- printf( "Exec: %s\n", sql ); SQLAllocHandle(SQL_HANDLE_STMT, dbc, &stmt); ret =3D SQLExecDirect(stmt, sql, SQL_NTS); if( SQL_SUCCEEDED(ret) ) printf("ok\n"); else printf("error\n"); SQLFreeHandle(SQL_HANDLE_STMT,stmt); sprintf( sql, "drop table if exists %s", av[2] ); SQLAllocHandle(SQL_HANDLE_STMT, dbc, &stmt); SQLExecDirect(stmt, sql, SQL_NTS); SQLFreeHandle(SQL_HANDLE_STMT,stmt); SQLDisconnect(dbc); } SQLFreeHandle(SQL_HANDLE_DBC, dbc); SQLFreeHandle(SQL_HANDLE_ENV, env); return 0; } =20 $ cat $ODBCINI [ODBC Data Sources] PGDriver =3D PG ODBC Data Source =20 [PGDriver] Driver =3D /usr/pgsql-9.6/lib/psqlodbcw.so Servername =3D <=E2=80=A6.> Port =3D 5432 Database =3D <=E2=80=A6.> Username =3D <=E2=80=A6.> Password =3D <=E2=80=A6.> =20 $ rpm -qa |grep postgresql postgresql96-server-9.6.5-1PGDG.rhel6.x86_64 postgresql96-9.6.5-1PGDG.rhel6.x86_64 postgresql96-libs-9.6.5-1PGDG.rhel6.x86_64 postgresql96-odbc-09.06.0500-1PGDG.rhel6.x86_64 =20 $ cat /etc/redhat-release Red Hat Enterprise Linux Server release 6.6 (Santiago) =20 - - - - - - - - - - - - - - - - - - - - - - - - - - - - =20 Regards =20 Georgy Pruss ------=_NextPart_000_00A5_01D35194.313912F0 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable

Hi,

Any news on new driver = for 9.6 on Linux?

I guess everybody must be busy with 10.0, but = still, maybe some progress=E2=80=A6

Thank = you!

G.P.

 

 

From: Inoue, Hiroshi = [mailto:h-inoue@dream.email.ne.jp]
Sent: Friday, October 13, = 2017 16:52
To: Georgy Pruss = <gpruss@ksf.kiev.ua>
Cc: = pgsql-odbc@postgresql.org
Subject: Re: [ODBC] error with $ in = names again

 

Hi Georgy,

On 2017/10/11 23:08, Inoue, Hiroshi = wrote:

Hi Gregory,

On 2017/10/11 19:44, Georgy Pruss = wrote:

Hi,

 

I think there=E2=80=99s = still a bug in parsing names with dollars.

Linux = RHEL66

 

UseServerSidePrepare=3D0:

 

create table T$001 = (=E2=80=A6)      ok

create table T_$001 = (=E2=80=A6)     ok

 

UseServerSidePrepare=3D1:

 

create table T$001 = (=E2=80=A6)      ok

create table T_$001 = (=E2=80=A6)     = error


Thanks for the report.
I would examine the = issue.


I = found a cause and committed the fix to git.
We would make a new = release soon.

regards,
Hiroshi = Inoue



regards,
Hiroshi = Inoue


 

Here is session log for = that:

 

$ test_odbc 0 = 'T$001'

Connection: = DSN=3DPGDriver;UseServerSidePrepare=3D0

Returned connection = string was: = =E2=80=A6;UseDeclareFetch=3D0;=E2=80=A6;Parse=3D0;=E2=80=A6;UseServerSide= Prepare=3D1;LowerCaseIdentifier=3D0;

Exec: create table T$001 = (i integer)

ok

 

$ test_odbc 1 = 'T$001'

Connection: = DSN=3DPGDriver;UseServerSidePrepare=3D1

Returned connection = string was: =E2=80=A6

Exec: create table T$001 (i = integer)

ok

 

$ test_odbc 0 = 'T_$001'

Connection: = DSN=3DPGDriver;UseServerSidePrepare=3D0

Returned connection = string was: =E2=80=A6

Exec: create table T_$001 (i = integer)

ok

 

$ test_odbc 1 = 'T_$001'

Connection: = DSN=3DPGDriver;UseServerSidePrepare=3D1

Returned connection = string was: =E2=80=A6

Exec: create table T_$001 (i = integer)

Error

 

ODBC error:  = "Parameters exist but IPD isn't set. Please call = SQLDescribeParam()"

 

I guess $n parameters = should not be allowed/treated in any ODBC statements except = PREPARE/EXECUTE at all, right?

In ODBC statements (and = in any case not in table names) it=E2=80=99s =E2=80=98?=E2=80=99, = right?

(I know, internally =E2=80=98?=E2=80=99 are = replaced by =E2=80=98$n=E2=80=99, maybe it=E2=80=99s too much for pure = =E2=80=98$=E2=80=99 sign =E2=80=93 literal strings, parameters for = PREPARE, internal parameters for ODBC=E2=80=A6)

 

- - - - - - - - - - - - = - - - - - - - - - - - - - - - -

 

$ cat = test_odbc.c

// gcc -I unixODBC-2.3.4/include -I = unixODBC-2.3.4 -L libs -lodbc test_odbc.c -o = test_odbc

// test_odbc 0|1 = 'tablename'

 

#include = <stdio.h>

#include <time.h>

#include = <sql.h>

#include = <sqlext.h>

 

int main(int ac, char* = av[])

{

  SQLHENV = env;

  SQLHDBC dbc;

  SQLRETURN = ret;

  SQLCHAR = outstr[1024];

  SQLSMALLINT = outstrlen;

  SQLHSTMT stmt;

  if( ac!=3D3 || = av[1][1]!=3D'\0' || !(av[1][0]=3D=3D'0' || av[1][0]=3D=3D'1') = )

    return printf( "Syntax: = test_odbc 0|1 'tablename'\n" ), 1;

  = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, = &env);

  SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, = (void*)SQL_OV_ODBC3, 0);

  SQLAllocHandle(SQL_HANDLE_DBC, env, = &dbc);

  char conn[512];

  sprintf( conn, = "DSN=3DPGDriver;UseServerSidePrepare=3D%s", av[1] = );

  printf( "Connection: %s\n", = conn );

  ret =3D SQLDriverConnect(dbc, NULL, conn, = SQL_NTS,

       outstr, = sizeof(outstr), &outstrlen, = SQL_DRIVER_COMPLETE);

  = if(!SQL_SUCCEEDED(ret))

    { fprintf(stderr, = "Failed to connect\n"); }

  = else

  {

    = printf("Returned connection string was:\n\t%s\n", = outstr);

    char = sql[512];

    sprintf( sql, "create = table %s (i integer)", av[2] );  // = <-------------

    printf( "Exec: = %s\n", sql );

    = SQLAllocHandle(SQL_HANDLE_STMT, dbc, &stmt);

    ret = =3D SQLExecDirect(stmt, sql, SQL_NTS);

    if( = SQL_SUCCEEDED(ret) )

      = printf("ok\n");

    = else

      = printf("error\n");

    = SQLFreeHandle(SQL_HANDLE_STMT,stmt);

    = sprintf( sql, "drop table if exists %s", av[2] = );

    = SQLAllocHandle(SQL_HANDLE_STMT, dbc, &stmt);

    = SQLExecDirect(stmt, sql, SQL_NTS);

    = SQLFreeHandle(SQL_HANDLE_STMT,stmt);

    = SQLDisconnect(dbc);

  }

  = SQLFreeHandle(SQL_HANDLE_DBC, dbc);

  = SQLFreeHandle(SQL_HANDLE_ENV, env);

  return = 0;

}

 

$ cat = $ODBCINI

[ODBC Data Sources]

PGDriver   =3D = PG ODBC Data Source

 

[PGDriver]

Driver     =3D = /usr/pgsql-9.6/lib/psqlodbcw.so

Servername =3D = <=E2=80=A6.>

Port       =3D = 5432

Database   =3D = <=E2=80=A6.>

Username   =3D = <=E2=80=A6.>

Password   =3D = <=E2=80=A6.>

 

$ rpm -qa |grep = postgresql

postgresql96-server-9.6.5-1PGDG.rhel6.x86_64

postgresql96-9.6.5-1PGDG.rhel6.x86_64=

postgresql96-libs-9.6.5-1PGDG.rhel6.x86_64=

postgresql96-odbc-09.06.0500-1PGDG.rhel6.x86_64

 

$ cat = /etc/redhat-release

Red Hat Enterprise Linux Server release 6.6 = (Santiago)

 

- - - - - - - - - - - - = - - - - - - - - - - - - - - - -

 

Regards

 

Georgy = Pruss

------=_NextPart_000_00A5_01D35194.313912F0--