| Goal | This query identifies all expressions that use the non-standard now() function. In PostgreSQL, now() is a historical, non-standard alias for the SQL-standard current_timestamp. While they are functionally identical within PostgreSQL (both returning the transaction start timestamp as a TIMESTAMPTZ), the use of current_timestamp is strongly preferred for reasons of code portability and adherence to standards. Standardizing on current_timestamp ensures the code is universally understood and easier to maintain or migrate to other database systems. |
|---|---|
| Type | Problem detection (Each row in the result could represent a flaw in the design) |
| Reliability | Medium (Medium number of false-positive results) |
| License | MIT (opens in new tab) |
| Fixing Suggestion | Replace now() with CURRENT_TIMESTAMP. |
| Data Source | INFORMATION_SCHEMA+system catalog |
| SQL Query |
|
Collections
This query belongs to the following collections:
Find problems automatically
Queries, that results point to problems in the database. Each query in the collection produces an initial assessment. However, a human reviewer has the final say as to whether there is a problem or not .
| Name | Description |
|---|---|
| Find problems automatically | Queries, that results point to problems in the database. Each query in the collection produces an initial assessment. However, a human reviewer has the final say as to whether there is a problem or not . |
Categories
This query is classified under the following categories:
Conformance to SQL standard
Queries of this category provide information about the use of constructs that conform to the SQL standard
Derived tables
Queries of this category provide information about the derived tables (views, materialized views), which are used to implement virtual data layer.
User-defined routines
Queries of this category provide information about the user-defined routines
| Name | Description |
|---|---|
| Conformance to SQL standard | Queries of this category provide information about the use of constructs that conform to the SQL standard |
| Derived tables | Queries of this category provide information about the derived tables (views, materialized views), which are used to implement virtual data layer. |
| User-defined routines | Queries of this category provide information about the user-defined routines |
Further reading and related materials: