Skip site navigation (1) Skip section navigation (2)

odbc 9.0.200 on delphi

From: Julius Tuskenis <julius(at)nsoft(dot)lt>
To: pgsql-odbc(at)postgresql(dot)org
Subject: odbc 9.0.200 on delphi
Date: 2011-03-17 22:13:15
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-odbc
Hello, postgresql ODBC community

This is my first post so firstly I'd like to thank you for the ODBC 
driver. We have several products using it (programming with Delphi 2006 
using ADO components (dbGo)).

We are now upgrading Postgresql server to v9, so we had to change odbc 
driver from to We observed some interesting 
behavior - sometimes the query is executed, but now rows are returned 
although we have no such problems executing queries using pgAdmin.

The problem occurs when the string parameter size is left as is (-1 in 
Delphi ) and value of 5 characters is passed. If I pass more or less 
character string - everything works as expected. Is the number 5 somehow 
"magical" in pqsql ODBC ?...

Steps to reproduce:
1. Create a function
CREATE OR REPLACE FUNCTION _test(prm_1 character varying)
   RETURNS integer AS
'select 0'
   COST 100;

2. Create a test Delphi program that would have a ADOConnection, 
ADOQuery, DataSource and DBGrid. Set the connection parameters, link the 

3. Add SQL to ADOQuery:
select _test(:prm_test ) as kuku;

4. Add button to the project with code in OnClick event
procedure TForm1.Button1Click(Sender: TObject);
   ADOConnection1.Connected := false;
   ADOQuery1.Parameters[0].Value := '12345';
   Caption := IntToStr(ADOQuery1.RecordCount);

5. Execute the program, hit the button, observe the query returning 
empty field in DBGrid, Caption becomes '0';

System info:
Server Version string    PostgreSQL 9.0.3 on i486-pc-linux-gnu, compiled 
by GCC gcc-4.4.real (Debian 4.4.5-10) 4.4.5, 32-bit
Client WinXP SP3
ODBC version (Using PostgreSQL Unicode driver)

I understand It's two systems (odbc and delphi) that are tested, but I 
don't know how to test ODBC only... Please advice what should I do about 
it.   Odbc v8.03.04.00 does not act like this.

Some more notices:
1. If I change OnClict event to
procedure TForm1.Button1Click(Sender: TObject);
   ADOConnection1.Connected := false;
   ADOQuery1.Parameters[0].Value := '12345';
   Caption := IntToStr(ADOQuery1.RecordCount);
Everything works as expected.

2. If I use query without parameters ( select _test('12345'  ) as kuku;) 
- everything is OK.

3. If I set parameter size of at least 6 result is ok.

I don't know what else to check. If there is a person who is willing to 
fix the problem I'd be more than pleased to help. Don't hesitate to ask 
for some logs or what ever information you find useful. I can provide 
Delphi source for the test application if needed.

Julius Tuskenis
Programavimo skyriaus vadovas
UAB nSoft
mob. +37068233050


pgsql-odbc by date

Next:From: Julius TuskenisDate: 2011-03-18 07:23:25
Subject: Re: odbc 9.0.200 on delphi
Previous:From: Arnaud LesauvageDate: 2011-03-16 09:20:50
Subject: Re: Access Autonumber fields not detected in 9.0.0200

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group