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
PostgreSQL : default expression not correctly updated
-
swierzbicki
- Posts: 451
- Joined: Wed 19 Jan 2005 09:59
Hello
It is not a bug - it is a feature. If you created persistent fields, they will be stored in DFM, and DefaultExpression will be not detected on each PgQuery opening. It allows increasing performance. If you want to detect DefaultExpression on each PgQuery opening, you should not create persistent fields in the design-time.
It is not a bug - it is a feature. If you created persistent fields, they will be stored in DFM, and DefaultExpression will be not detected on each PgQuery opening. It allows increasing performance. If you want to detect DefaultExpression on each PgQuery opening, you should not create persistent fields in the design-time.