"Invalid input syntax for type timestamp with time zone" on insert/update, postgreSQL
See original GitHub issueI’m unable to use the hasTimestamps successfully and not sure why. I’m also using Bookshelf, but I think the problem is at the knex level.
From my initial migration script:
exports.up = function(knex, Promise) {
return Promise.all(
[ knex.schema.createTable('whatevers', function (table) {
table.uuid('id').primary();
// snip
table.timestamps();
})
]
);
};
From my bookshelf.js model definition:
WhateverModel =
{ tableName: 'whatevers'
, hasTimestamps: true
, defaults: function () {
var d =
{ id: uuid.v1()
}
;
return d;
}
};
The error I get on Insert or Update is:
error { [error: invalid input syntax for type timestamp with time zone: "{}"]
name: 'error',
length: 119,
severity: 'ERROR',
code: '22007',
detail: undefined,
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
file: 'datetime.c',
line: '3567',
routine: 'DateTimeParseError' }
Issue Analytics
- State:
- Created 9 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
[22007] ERROR: invalid input syntax for type timestamp ...
Have you tried casting your WHERE clause: WHERE cast(foo.valueTS AS TIMESTAMP) <= now();. Also have you tried using CURRENT_TIMESTAMP ...
Read more >ERROR: invalid input syntax for type timestamp with time zone
(timestamptz_in() -> DecodeDateTime()). But when I tried to enter same date with other format then it does work.
Read more >Thread: invalid input syntax for type timestamp.
Hi. I was doing the field test of Slony-I 1.2.2 release now. However, I encounter the problem of timestamp.:-( Was anyone recognizing this...
Read more >T31392 PostgreSQL invalid input syntax for type timestamp ...
Changing the timestamp type in ApiBase.php is a bad idea. Changing it to TS_POSTGRES is even worse, because that'll break on non-Postgres backends....
Read more >invalid input syntax for type timestamp with time zone #301
pg_partman currently only works with the data type timestamp with time zone . Unless you have a very specific need for timestamp without...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, looks like a bad library choice on my part. ‘snakeize’ was turning my Date objects into bare objects in my model’s format() function.
@brunolm No clue what I ended up doing. This was three jobs ago! My guess is that I monkey-patched things and kept moving. (I recall this app growing an appendix of monkey-patches, as we locked down dependencies pretty early in development. Relying on npm and accurate semver was a lot sketchier in 2014.