PostGres TimeStamp (with time zone) agro... again

Posts   
 
    
JSobell
User
Posts: 145
Joined: 07-Jan-2006
# Posted on: 22-Mar-2022 01:44:32   

What is the suggested approach for storing and handling UTC timezone datetimes in PostGres through LLBLGen?

I have a table with all of its fields defined at timestamp with time zone

My Entity object has a property LastEdited of type DateTime?

If I set a datetime in that property as Kind=UTC, I get an error from the server saying SD.LLBLGen.Pro.ORMSupportClasses.ORMQueryExecutionException: An exception was caught during the execution of an action query: Cannot write DateTime with Kind=UTC to PostgreSQL type 'timestamp without time zone', consider using 'timestamp with time zone'. Note that it's not possible to mix DateTimes with different Kinds in an array/range. See the Npgsql.EnableLegacyTimestampBehavior AppContext switch to enable legacy behavior.. Check InnerException, QueryExecuted and Parameters of this exception to examine the cause of this exception.

I already have defined the field as with time zone, which I assumed meant the DateTime should be flagged as UTC, but the only way I can write a value is to pass it in as non-UTC DateTime object.

I'm no Postgres guru, so what is the appropriate combination of types to make this work?

JSobell
User
Posts: 145
Joined: 07-Jan-2006
# Posted on: 22-Mar-2022 01:59:46   

OK, ignore this. I forgot to do a resync with the database before regenerating my libraries.

D'oh