Inserting data into PostgreSQL partitioned table and reporting errors: The subtable appears to exist but is reported as not existing, and column “xxx“ does not exist. Solution

Record two problems encountered when inserting partition tables:

Question 1. A partitioned table needs to create a sub-table before inserting it. If the sub-table is created and inserted immediately, an error may be reported that the sub-table does not exist;

Solution: After creating the subtable and index, insert data into the subtable after sleeping for 10 milliseconds;

Problem 2. Prompt column “xxx“ does not exist Solution

This problem is really difficult to check. The two SQLs look exactly the same, but one reports an error and the other does not. Only the imported files are different. I guess it is the file.
Insert image description hereInsert image description here

But what exactly? Come and hammer it down
Insert image description here

Solution: Replace illegal characters, or save the original file and remove illegal characters.

The wrong file has illegal characters in front of it: \uFEFF; How to solve it? Code compatibility,
1. Replace illegal characters each time;
2. The file is processed in notpad++ and illegal characters are removed;

Reserved to use UTF-8 encoding, using UTF-8BOM encoding is problematic.
Insert image description here

reference

Guess you like

Origin blog.csdn.net/qq_40985985/article/details/134536557