Connection.GetSchema(...) delivers wrong defaultvalue after renaming a defaultvalue of a enum-table column in database

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
tgrossjean
Posts: 6
Joined: Fri 26 Mar 2010 09:48
Location: Germany

Connection.GetSchema(...) delivers wrong defaultvalue after renaming a defaultvalue of a enum-table column in database

Post by tgrossjean » Mon 17 Jun 2013 15:28

/*

-- Create a type and a table using that type with a defaultvalue in the database:

drop table if exists testtab;
drop type if exists testtype;
drop type if exists new_testtype;

create type testtype as enum
(
'OK',
'NOTOK'
);

create table testtab
(
t testtype default 'OK'
);
*/


PgSqlConnection conn = EdGlobals.Connection;
var v = EdGlobals.Connection.GetSchema("Columns", new string[] { "%", "testtab", "%" }).Rows[0]["defaultvalue"];

// Result is RIGHT:
//'OK'::testtype

/*

-- Now, change the name of the type in the database:

alter type testtype rename to new_testtype;

*/

v = EdGlobals.Connection.GetSchema("Columns", new string[] { "%", "testtab", "%" }).Rows[0]["defaultvalue"];

// Result is WRONG: !!!!!!
//'OK'::testtype



/*

-- Querying the information-schema the following way always delivers the right values:

SELECT column_name, column_default
FROM information_schema.columns
WHERE (table_schema, table_name) = ('public', 'testtab')
ORDER BY ordinal_position;

*/

Pinturiccio
Devart Team
Posts: 2420
Joined: Wed 02 Nov 2011 09:44

Re: Connection.GetSchema(...) delivers wrong defaultvalue after renaming a defaultvalue of a enum-table column in database

Post by Pinturiccio » Tue 18 Jun 2013 14:34

We have reproduced the issue. We will investigate it and notify you about the results as soon as possible.

Pinturiccio
Devart Team
Posts: 2420
Joined: Wed 02 Nov 2011 09:44

Re: Connection.GetSchema(...) delivers wrong defaultvalue after renaming a defaultvalue of a enum-table column in database

Post by Pinturiccio » Wed 19 Jun 2013 13:05

We have fixed the bug with retrieving default value data for table columns when calling the PgSqlConnection.GetSchema("Columns") method. We will post here when the corresponding build of dotConnect for PostgreSQL is available for download.

Pinturiccio
Devart Team
Posts: 2420
Joined: Wed 02 Nov 2011 09:44

Re: Connection.GetSchema(...) delivers wrong defaultvalue after renaming a defaultvalue of a enum-table column in database

Post by Pinturiccio » Tue 25 Jun 2013 08:14

The new build of dotConnect for PostgreSQL 6.6.267 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).
For more information, please refer to http://forums.devart.com/viewtopic.php?t=27384

Post Reply