Can't load empty array in binary mode

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
Tiago_G
Posts: 8
Joined: Wed 14 Apr 2010 09:26

Can't load empty array in binary mode

Post by Tiago_G » Mon 28 Mar 2011 13:57

Hello,

I'm trying to load an empty PgSqlArray, created with the PgSqlArray.CreateEmptyArray method.
It's working in Text mode.
in Binary mode, when executing loader.NextRow() i get a NullReferenceException. Can you verify it?

Thanks!

Regards,
Tiago

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Tue 29 Mar 2011 14:04

I have checked dotConnect for PostgreSQL v 5.10.126 and PostgreSQL server v 9.0 with the following code:

Code: Select all

    //CREATE TABLE array_test ( 
    //  arr integer[] NOT NULL 
    //);
    
    using (PgSqlConnection conn = new PgSqlConnection()) {
        conn.ConnectionString = "server=***;port=***;database=***;uid=***;pwd=***;Protocol=3;";
        conn.Open();
        PgSqlArray array = PgSqlArray.CreateEmptyArray(PgSqlType.Int);
        using (PgSqlLoader loader = new PgSqlLoader()) {
            loader.Connection = conn;
            loader.TableName = "array_test";
            loader.Open();
            loader["arr"] = array;
            loader.NextRow();
            loader.Close();
        }
    }
It works. Please tell us your versions of dotConnect for PostgreSQL (x.xx.xxx), PostgreSQL server, and the way we should modify this sample to reproduce the problem.

Tiago_G
Posts: 8
Joined: Wed 14 Apr 2010 09:26

Post by Tiago_G » Wed 30 Mar 2011 10:12

Hello,

I'm using v4.95.152 with PostgreSQL 8.4

I changed the sample to change the mode (the default is text mode from what i can see here):

Code: Select all

    //CREATE TABLE array_test ( 
    //  arr integer[] NOT NULL 
    //);
    
    using (PgSqlConnection conn = new PgSqlConnection()) {
        conn.ConnectionString = "server=***;port=***;database=***;uid=***;pwd=***;Protocol=3;";
        conn.Open();
        PgSqlArray array = PgSqlArray.CreateEmptyArray(PgSqlType.Int);
        using (PgSqlLoader loader = new PgSqlLoader()) {
            loader.Connection = conn;
            loader.TableName = "array_test";
            loader.Mode = PgSqlLoaderMode.Binary;    //added
            loader.Open();
            loader["arr"] = array;
            loader.NextRow();
            loader.Close();
        }
    }
Thanks!

Regards,
Tiago

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Wed 30 Mar 2011 15:03

We have reproduced the "Cannot convert value" error when PgSqlLoaderMode.Binary and the "Protocol=3;" connection string parameter are used. We will investigate the issue and notify you about the results.
As a workaround, please use either PgSqlLoaderMode.Text or "Protocol=2;".

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Tue 05 Apr 2011 14:05

The issue with binary mode of PgSqlLoader and empty array is fixed. I will post here when the corresponding build of dotConnect for PostgreSQL is available for download.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Thu 07 Apr 2011 14:21

New build of dotConnect for PostgreSQL 5.10.135 is available for download now!
It can be downloaded from http://www.devart.com/dotconnect/postgr ... nload.html (trial version) or from Registered Users' Area (for users with valid subscription only): http://secure.devart.com/ .

For more information, please refer to http://www.devart.com/forums/viewtopic.php?t=20709 .

Post Reply