Skip to content

SQL-002 PostgreSQL system date

This raw SQL statement is issued by PostgreSqlSessionHelper/SessionHelperBase to read the PostgreSQL database server's current date, which backs the ISessionHelper.SystemDate/IRepository<TEntity>.SystemDate property consumers use for server-authoritative timestamps (see BR-NH-17).

PostgreSQL caveat: current_date returns a DATE-only value (midnight, no time-of-day component), unlike Oracle's sysdate/SQL Server's GetDate(), which both return full date+time — see BR-NH-17 and Get database system date.

Classification

Field Value
SQL ID SQL-002
Operation type Read
Execution method Inline SQL via ISessionStrategy.CreateSqlQuery(string).UniqueResult()
Database PostgreSQL
Schema Unqualified** (depends on the consumer's connection string/search_path)
Command type Text
Business object N/A (Application layer)
Criteria property N/A
Lifecycle method N/A
Application class PostgreSqlSessionHelper (via SessionHelperBase.SystemDate)

Parameters

This statement has no parameters.

Tables

No tables — current_date is a PostgreSQL built-in function and requires no FROM clause.

Sample SQL

SELECT
  current_date

Operations and processes

Business rules

Note: Statements marked with ** could not be confirmed; treat as unknown until verified.

Sources

  • src/SAIF.NetCore.Nhibernate/SAIF.NetCore.NHibernate/SAIF.NetCore.NHibernate/SessionHelpers/PostgreSqlSessionHelper.cs
  • src/SAIF.NetCore.Nhibernate/SAIF.NetCore.NHibernate/SAIF.NetCore.NHibernate/SessionHelpers/SessionHelperBase.cs