Hello, I am running Yugabyte 126.96.36.199 on single node, and I am executing via ysqlsh an SQL script on a “fresh” database that creates the database schema and inserts data into some of the newly created tables. The SQL script therefore contains both DDL and DML statements, and these are interspersed (for example, a table is created, then there may be some INSERT statements for this table, then another table is created, and so forth).
I have seen the following happen once, after the following SQL was executed:
CREATE TABLE ptcraneregion
region CHARACTER VARYING,
CONSTRAINT pk_pt_crane_region PRIMARY KEY(id)
insert into ptcraneregion values (1,‘A’,0.000088,3.45,2.27,0.205,1.49);
with the following appearing in the ~/var/logs/tserver/postgresql-2022-03-30_000000.log file:
I0330 09:49:57.246927 297368 ybccmds.c:482] Creating Table my_database.public.ptcraneregion
2022-03-30 09:49:57.383 UTC  ERROR: could not open relation with OID 66783 at character 13
2022-03-30 09:49:57.383 UTC  STATEMENT: insert into ptcraneregion values (1,‘A’,0.000088,3.45,2.27,0.205,1.49);
Is there anything we can do to avoid such error? For example, do we need to wait for some time period to elapse before inserting data into a newly created table?
Your input is greatly appreciated.