Home > Net >  PostgreSQL : Hint: No operator matches the given name and argument types
PostgreSQL : Hint: No operator matches the given name and argument types

Time:10-17

When I execute my query I have this error :

Query failed: ERROR: operator does not exist: "GOOD_RECIEPT_ANOMALY_DETECTION_V2_last_alerts_sent_gsheet_histo" > timestamp without time zone Hint: No operator matches the given name and argument types. You might need to add explicit type casts. Position: 176

Here is my SQL query :

SELECT *
FROM "GOOD_RECIEPT_ANOMALY_DETECTION_V2_last_alerts_sent_gsheet_historic"
WHERE "GOOD_RECIEPT_ANOMALY_DETECTION_V2_last_alerts_sent_gsheet_historic.PO_Creation_date" > 
CURRENT_DATE - INTERVAL '1 month'

I work on PostgreSQL database. I think the problem comes from the PO_Creation_date type but I don't understand that it should be cast since it is in date format

CodePudding user response:

use ::DATE

SELECT *
FROM "GOOD_RECIEPT_ANOMALY_DETECTION_V2_last_alerts_sent_gsheet_historic"
WHERE "GOOD_RECIEPT_ANOMALY_DETECTION_V2_last_alerts_sent_gsheet_historic"."PO_Creation_date"::DATE > CURRENT_DATE - INTERVAL '1 month'
  • Related