question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Postgresql CREATE TABLE AS fails with timestamp columns

See original GitHub issue

When trying to use CREATE TABLE postgres_catalog.schema.table_name AS SELECT timestamp_column from another_pg_catalog.schema.table Presto throws an error.


Query 20170405_151901_00163_hzzb8, FAILED, 3 nodes
Splits: 52 total, 34 done (65.38%)
0:02 [1 rows, 0B] [0 rows/s, 0B/s]

Query 20170405_151901_00163_hzzb8 failed: Batch entry 0 INSERT INTO "postgres"."my_schema"."tmp_presto_88aa4cf1e3724dd5a45010ab786fd074" VALUES (1443814801104) was aborted.  Call getNextException to see the cause.

When I go into the target Postgres logs to see more detail the error seems to be that its trying to insert a bigint instead of a timestamp.

2017-04-05 15:19:03.740 GMT,...,"PARSE",...,ERROR,42804,"column ""created_date"" is of type timestamp without time zone but expression is of type bigint",,"You will need to rewrite or cast the expression.",,,,"INSERT INTO ""postgres"".""my_schema"".""tmp_presto_88aa4cf1e3724dd5a45010ab786fd074"" VALUES ($1)",88,,"

Not sure if I’m doing something wrong but I appear to have this issue when trying to CREATE TABLE _ AS SELECT .. with any timestamp column in the select.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:5
  • Comments:15 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
wfariacommented, Jan 30, 2020

Hello, any news about this? I am using Presto 0.227 and PostgreSQL 10.6 and still getting the same issue reported by others here.

Thanks!

0reactions
noahkawasakigooglecommented, Nov 6, 2020

Then you must be using PrestoSQL, not PrestoDB?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Documentation: 15: CREATE TABLE - PostgreSQL
A data row inserted into the table is routed to a partition based on the value of columns or expressions in the partition...
Read more >
how to specify format of timestamp while creating table in ...
I guess I have to specify the timestamp format while creating table so that it can accept the input in "YYYYMMDDHHMMSS" format. Any...
Read more >
PostgreSQL CREATE TABLE
This tutorial shows you how to use the PostgreSQL CREATE TABLE statement to create new tables. ... Third, specify a comma-separated list of...
Read more >
postgresql - Formatting Timestamp in Default Constraint
Can you format a TIMESTAMP WITH TIME ZONE column in a CREATE TABLE default constraint in Postgres v10.x? ... However, according to the...
Read more >
CREATE TABLE - Amazon Redshift
The data type of a distribution key column can be: BOOLEAN, REAL, DOUBLE PRECISION, SMALLINT, INTEGER, BIGINT, DECIMAL, DATE, TIME, TIMETZ, TIMESTAMP, or ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found