-
Notifications
You must be signed in to change notification settings - Fork 549
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to copy data between tables using the syntax: INSERT INTO test2 (SELECT * FROM test)
#15837
Comments
Hi, INSERT INTO my_schema.table2 ("test_int","test_string","timestamp")
SELECT "test_int","test_string","timestamp"
FROM my_schema.table1 |
Hey! I had already tried your suggestion and it also doesn't work. |
How did you get data into There is an issue tracking feedback with failing |
The data inserted into the test table was generated by a script, just for testing purposes. This is it:
Which results in a query similar to: |
I just saw that you I quickly played around with older versions and could validate that form 4.6 - 5.2 the following query fails: CREATE TABLE IF NOT EXISTS "my_schema"."test" (
"test_int" INTEGER,
"test_string" TEXT,
"timestamp" TIMESTAMP WITH TIME ZONE,
"edate" TIMESTAMP WITH TIME ZONE GENERATED ALWAYS AS date_trunc('week', "timestamp")
)
CLUSTERED INTO 4 SHARDS
PARTITIONED BY ("timestamp");
INSERT INTO my_schema.test (test_int,test_string,"timestamp") SELECT 1,'a',x FROM generate_series(now(),now()+'50 days'::INTERVAL,'1 day'::INTERVAL) g(x); Partitions are created, but not records are inserted.
Changing your table definition to CREATE TABLE IF NOT EXISTS "my_schema"."test" (
"test_int" INTEGER,
"test_string" TEXT,
"timestamp" TIMESTAMP WITH TIME ZONE,
"edate" TIMESTAMP WITH TIME ZONE GENERATED ALWAYS AS date_trunc('week', "timestamp")
)
CLUSTERED INTO 4 SHARDS
PARTITIONED BY ("edate"); and partitioning by Considering this issue as identified and fixed I will close this issue. |
CrateDB version
4.6
CrateDB setup information
Number of nodes: 1
Problem description
No response
Steps to Reproduce
INSERT INTO my_schema.table2 (SELECT * FROM my_schema.table1)
Actual Result
No error will be returned, the only returned message will be something like:
INSERT OK, 0 records affected (5.012 seconds)
. While the query took 5 seconds, no actual data is copied.When checking the tables view in CrateDB web platform, the number of shards present in test2 is the same as the ones present in test. But the total records is 0.
Here is the test table:
Here is the test2 table, showing shards but 0 total records:
Expected Result
Since both tables have the same schema, only differing in the number of shards, data should be copied without a problem.
The text was updated successfully, but these errors were encountered: