PostgreSQL : default expression not correctly updated
Posted: Fri 16 Dec 2011 20:43
Hello,
I'm getting issues with TField DefaultExpression not being updated.
I'm working with the UniPostgreSQL connector. My TUniquery has the option "DefaultValues" checked.
How to reproduce :
With your favorite DB tool create a table with a serial field type. Associate a sequence to this field (default field value).
Delphi :
Create a basic project with a UniPostgreSQL, UniConnection, UniDataset, UniQuery, DBNavigator and crDbTable components. Link everything.
Fill the Uniquery with such an SQL statement : select * from Table.
Be sure that UniQuery has the option "DefaultValues" checked.
Be sure that UniQuery has all refresh options checked.
Set everything active (UniConnection and UniQuery)
Compile and run.
Insert a new record =>new record will be inserted with the corresponding sequence.
Close your project.
With your favorite DB tool rename the sequence (and be sure that the field definition is updated too).
With your favorite DB Tool edit the table and try to insert a row (testing purpose).
Delphi :
Open your project again
Be sure that all connection are set to true
Compile and run the project again
Try to insert a new record : you will get an error telling that the sequence doesn' exists (the old name is used and not the new one).
If you create persistents fields for the TUniQuery you will see that the default expression isn't refreshed and is still referencing the old value...
Infos :
Windows 7 32 bits - 2go Ram
Delphi XE
Latest UniDAC
Server version: PostgreSQL 9.1.2, compiled by Visual C++ build 1500, 32-bit
Client version: 8.0 Direct
I'm getting issues with TField DefaultExpression not being updated.
I'm working with the UniPostgreSQL connector. My TUniquery has the option "DefaultValues" checked.
How to reproduce :
With your favorite DB tool create a table with a serial field type. Associate a sequence to this field (default field value).
Delphi :
Create a basic project with a UniPostgreSQL, UniConnection, UniDataset, UniQuery, DBNavigator and crDbTable components. Link everything.
Fill the Uniquery with such an SQL statement : select * from Table.
Be sure that UniQuery has the option "DefaultValues" checked.
Be sure that UniQuery has all refresh options checked.
Set everything active (UniConnection and UniQuery)
Compile and run.
Insert a new record =>new record will be inserted with the corresponding sequence.
Close your project.
With your favorite DB tool rename the sequence (and be sure that the field definition is updated too).
With your favorite DB Tool edit the table and try to insert a row (testing purpose).
Delphi :
Open your project again
Be sure that all connection are set to true
Compile and run the project again
Try to insert a new record : you will get an error telling that the sequence doesn' exists (the old name is used and not the new one).
If you create persistents fields for the TUniQuery you will see that the default expression isn't refreshed and is still referencing the old value...
Infos :
Windows 7 32 bits - 2go Ram
Delphi XE
Latest UniDAC
Server version: PostgreSQL 9.1.2, compiled by Visual C++ build 1500, 32-bit
Client version: 8.0 Direct