Page 1 of 1

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

Posted: Mon 17 Jun 2013 15:28
by tgrossjean
/*

-- 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;

*/

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

Posted: Tue 18 Jun 2013 14:34
by Pinturiccio
We have reproduced the issue. We will investigate it and notify you about the results as soon as possible.

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

Posted: Wed 19 Jun 2013 13:05
by Pinturiccio
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.

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

Posted: Tue 25 Jun 2013 08:14
by Pinturiccio
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