pgSqlDump dealing with timestamp exception thrown
Posted: Fri 15 Mar 2013 20:17
I've been experimenting with dotConnect for PostgreSQL's pqSqlDump class and came across a consistency of the class throwing exceptions for 33 of the 130 table. I made a list of the tables and looped through them to see which were throwing the exception of "A first chance exception of type 'System.InvalidCastException' occurred in Devart.Data.PostgreSql.dll".
I found the commonality of the field type that being a timestamp. It also failed with timestamp without time zone. So I created a table and retried to confirm the issue.
The code to reproduce the thrown exception is below with the exception thrown at the pgSqlDump.Backup call.
The code generated into that SQLDumpbbb.dmp file gets truncated and looks like
Devart.Data.dll version 5.0.661.0
Devart.Data.Linq.dll version 4.1.207
Devart.Data.PostgreSql.dll version 6.5.202.0
Devart.Data.PostgreSql.Linq.dll version 4.1.207
Visual Studio 2010 SP1
PostgreSQL version 8.3.23 build 1400 on Windows 7
I found the commonality of the field type that being a timestamp. It also failed with timestamp without time zone. So I created a table and retried to confirm the issue.
Code: Select all
CREATE TABLE bbb ( datetaken timestamp ) WITH ( OIDS=FALSE );
ALTER TABLE bbb OWNER TO xyz;
Code: Select all
foreach ( String tableName in tableList )
{
using ( PgSqlDump pgSqlDump = new PgSqlDump( conn ))
{
pgSqlDump.Tables = tableName;
pgSqlDump.Backup(); //<=== exception thrown here
}
}
Code: Select all
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;
SET default_tablespace = '';
SET default_with_oids = false;
CREATE TABLE public.bbb
(
Devart.Data.dll version 5.0.661.0
Devart.Data.Linq.dll version 4.1.207
Devart.Data.PostgreSql.dll version 6.5.202.0
Devart.Data.PostgreSql.Linq.dll version 4.1.207
Visual Studio 2010 SP1
PostgreSQL version 8.3.23 build 1400 on Windows 7