Page 1 of 1

PgSqlArray with PgSqlType.ByteA

Posted: Fri 29 Jul 2011 15:43
by Ralf Jansen
Hi,

i'm trying to send an array of bytes[] as PgSqlType.ByteA to a stored function.

Code: Select all

byte[][] positions = new byte[10][];
// filling positions - 2.Dimension is of variable length

using (PgSqlCommand command = CreateCommand(tx))
{
    command.CommandType = CommandType.StoredProcedure;
    command.CommandText = @"MyProc";
    command.Parameters.Add("@param", PgSqlType.Array).Value = new PgSqlArray(positions, PgSqlType.ByteA, 1, positions.Length);
    command.ExecuteNonQuery();
}
I receive an
Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.
Exception on ExecuteNonQuery(). I have no problem doing the same with Varchar, Int, BigInt etc. Did i hit a limitation of the Array Type or am i doing something wrong?

Ralf

Posted: Tue 02 Aug 2011 15:18
by Shalex
Is DDL of "MyProc" something like this?

Code: Select all

create or replace function "MyProc"(bytea[]) returns...
Please specify the DDL of your "MyProc", the versions of your dotConnect for PostgreSQL (x.xx.xxx) and PostgreSQL server (x.x.x).

Posted: Wed 03 Aug 2011 07:27
by Ralf Jansen
MyProc just looks like this

Code: Select all

CREATE OR REPLACE FUNCTION fn_MyProc (cpositions bytea[])
  RETURNS void AS
$BODY$
BEGIN
   -- nop
END $BODY$
  LANGUAGE plpgsql VOLATILE STRICT
  COST 100;
The dotConnect Version is 5.30.196.0 and the PostgreSQL Server is 9.0.4 64bit.

But i have to say that i could not replicate the behaviour this morning. Possibly i had some interference with the same test using varchar instead of bytea. See the other thread where you said you could reproduce the error when using varchar.

Thanks
Ralf

Posted: Wed 03 Aug 2011 14:13
by Shalex