Reputation: 648
I try to select all records of a table (Postgres DB) with the following sql:
SELECT * FROM 'tablename' WHERE 'myTimestampRow' >= now()
There's allways an error message, telling me that there's an 'invalid input syntax for type timestamp with time zone: "myTimestampRow"'.
What's wrong with the above query?
Upvotes: 13
Views: 16514
Reputation: 169364
Lose the single-quotes:
SELECT * FROM tablename WHERE myTimestampRow >= now()
You can optionally double-quote column- and table-names, but no single-quotes; they will be interpreted as characters/strings.
Upvotes: 22
Reputation: 340321
You have
SELECT * FORM
instead of
SELECT * FROM
but that might be a typo in the question. I think your problem is the quoting of the columns, it should read either
SELECT * FROM table WHERE timestampRow >= now();
(no quotes) or
SELECT * FROM "table" WHERE "timestampRow" >= now();
Upvotes: 2