Registering pre-existing tables
onek
onek2
int8_tbl
--
-- SELECT_INTO
--
SELECT *
INTO TABLE sitmp1
FROM onek
WHERE onek.unique1 < 2;
-stdin-:: Error: Parse Sql
-stdin-::1:1: Error: SelectStmt: not supported intoClause
--
^
DROP TABLE sitmp1;
SELECT *
INTO TABLE sitmp1
FROM onek2
WHERE onek2.unique1 < 2;
-stdin-:: Error: Parse Sql
-stdin-::1:1: Error: SelectStmt: not supported intoClause
SELECT *
^
DROP TABLE sitmp1;
--
-- SELECT INTO and INSERT permission, if owner is not allowed to insert.
--
CREATE SCHEMA selinto_schema;
-stdin-:: Error: Parse Sql
-stdin-::1:1: Error: RawStmt: alternative is not implemented yet : 292
--
^
CREATE USER regress_selinto_user;
-stdin-:: Error: Parse Sql
-stdin-::1:1: Error: RawStmt: alternative is not implemented yet : 285
CREATE USER regress_selinto_user;
^
ALTER DEFAULT PRIVILEGES FOR ROLE regress_selinto_user
REVOKE INSERT ON TABLES FROM regress_selinto_user;
-stdin-:: Error: Parse Sql
-stdin-::1:1: Error: RawStmt: alternative is not implemented yet : 250
ALTER DEFAULT PRIVILEGES FOR ROLE regress_selinto_user
^
GRANT ALL ON SCHEMA selinto_schema TO public;
-stdin-:: Error: Parse Sql
-stdin-::1:1: Error: RawStmt: alternative is not implemented yet : 248
GRANT ALL ON SCHEMA selinto_schema TO public;
^
SET SESSION AUTHORIZATION regress_selinto_user;
-stdin-:: Error: Parse Sql
-stdin-::1:1: Error: VariableSetStmt, not supported name: session_authorization
SET SESSION AUTHORIZATION regress_selinto_user;
^
-- WITH DATA, passes.
CREATE TABLE selinto_schema.tbl_withdata1 (a)
AS SELECT generate_series(1,3) WITH DATA;
-stdin-:: Error: Parse Sql
-stdin-::1:1: Error: RawStmt: alternative is not implemented yet : 277
-- WITH DATA, passes.
^
INSERT INTO selinto_schema.tbl_withdata1 VALUES (4);
-stdin-:: Error: Parse Sql
-stdin-::1:1: Error: Unknown cluster: selinto_schema
INSERT INTO selinto_schema.tbl_withdata1 VALUES (4);
^
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
CREATE TABLE selinto_schema.tbl_withdata2 (a) AS
SELECT generate_series(1,3) WITH DATA;
-stdin-:: Error: Parse Sql
-stdin-::1:1: Error: RawStmt: alternative is not implemented yet : 276
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
^
-- WITH NO DATA, passes.
CREATE TABLE selinto_schema.tbl_nodata1 (a) AS
SELECT generate_series(1,3) WITH NO DATA;
-stdin-:: Error: Parse Sql
-stdin-::1:1: Error: RawStmt: alternative is not implemented yet : 277
-- WITH NO DATA, passes.
^
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
CREATE TABLE selinto_schema.tbl_nodata2 (a) AS
SELECT generate_series(1,3) WITH NO DATA;
-stdin-:: Error: Parse Sql
-stdin-::1:1: Error: RawStmt: alternative is not implemented yet : 276
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
^
-- EXECUTE and WITH DATA, passes.
PREPARE data_sel AS SELECT generate_series(1,3);
-stdin-:: Error: Parse Sql
-stdin-::1:1: Error: RawStmt: alternative is not implemented yet : 301
-- EXECUTE and WITH DATA, passes.
^
CREATE TABLE selinto_schema.tbl_withdata3 (a) AS
EXECUTE data_sel WITH DATA;
-stdin-:: Error: Parse Sql
-stdin-::1:1: Error: RawStmt: alternative is not implemented yet : 277
CREATE TABLE selinto_schema.tbl_withdata3 (a) AS
^
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
CREATE TABLE selinto_schema.tbl_withdata4 (a) AS
EXECUTE data_sel WITH DATA;
-stdin-:: Error: Parse Sql
-stdin-::1:1: Error: RawStmt: alternative is not implemented yet : 276
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
^
-- EXECUTE and WITH NO DATA, passes.
CREATE TABLE selinto_schema.tbl_nodata3 (a) AS
EXECUTE data_sel WITH NO DATA;
-stdin-:: Error: Parse Sql
-stdin-::1:1: Error: RawStmt: alternative is not implemented yet : 277
-- EXECUTE and WITH NO DATA, passes.
^
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
CREATE TABLE selinto_schema.tbl_nodata4 (a) AS
EXECUTE data_sel WITH NO DATA;
-stdin-:: Error: Parse Sql
-stdin-::1:1: Error: RawStmt: alternative is not implemented yet : 276
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
^
RESET SESSION AUTHORIZATION;
-stdin-:: Error: Parse Sql
-stdin-::1:1: Error: VariableSetStmt, not supported kind: 4
RESET SESSION AUTHORIZATION;
^
ALTER DEFAULT PRIVILEGES FOR ROLE regress_selinto_user
GRANT INSERT ON TABLES TO regress_selinto_user;
-stdin-:: Error: Parse Sql
-stdin-::1:1: Error: RawStmt: alternative is not implemented yet : 250
ALTER DEFAULT PRIVILEGES FOR ROLE regress_selinto_user
^
SET SESSION AUTHORIZATION regress_selinto_user;
-stdin-:: Error: Parse Sql
-stdin-::1:1: Error: VariableSetStmt, not supported name: session_authorization
SET SESSION AUTHORIZATION regress_selinto_user;
^
RESET SESSION AUTHORIZATION;
-stdin-:: Error: Parse Sql
-stdin-::1:1: Error: VariableSetStmt, not supported kind: 4
RESET SESSION AUTHORIZATION;
^
DEALLOCATE data_sel;
-stdin-:: Error: Parse Sql
-stdin-::1:1: Error: RawStmt: alternative is not implemented yet : 303
DEALLOCATE data_sel;
^
DROP SCHEMA selinto_schema CASCADE;
-stdin-:: Error: Parse Sql
-stdin-::1:1: Error: DropStmt: alternative is not implemented yet : 228
DROP SCHEMA selinto_schema CASCADE;
^
DROP USER regress_selinto_user;
-stdin-:: Error: Parse Sql
-stdin-::1:1: Error: RawStmt: alternative is not implemented yet : 287
DROP USER regress_selinto_user;
^
-- Tests for WITH NO DATA and column name consistency
CREATE TABLE ctas_base (i int, j int);
INSERT INTO ctas_base VALUES (1, 2);
CREATE TABLE ctas_nodata (ii, jj, kk) AS SELECT i, j FROM ctas_base; -- Error
-stdin-:: Error: Parse Sql
-stdin-::1:1: Error: RawStmt: alternative is not implemented yet : 277
CREATE TABLE ctas_nodata (ii, jj, kk) AS SELECT i, j FROM ctas_base; -- Error
^
CREATE TABLE ctas_nodata (ii, jj, kk) AS SELECT i, j FROM ctas_base WITH NO DATA; -- Error
-stdin-:: Error: Parse Sql
-stdin-::1:1: Error: RawStmt: alternative is not implemented yet : 277
CREATE TABLE ctas_nodata (ii, jj, kk) AS SELECT i, j FROM ctas_base WITH NO DATA; -- Error
^
CREATE TABLE ctas_nodata (ii, jj) AS SELECT i, j FROM ctas_base; -- OK
-stdin-:: Error: Parse Sql
-stdin-::1:1: Error: RawStmt: alternative is not implemented yet : 277
CREATE TABLE ctas_nodata (ii, jj) AS SELECT i, j FROM ctas_base; -- OK
^
CREATE TABLE ctas_nodata_2 (ii, jj) AS SELECT i, j FROM ctas_base WITH NO DATA; -- OK
-stdin-:: Error: Parse Sql
-stdin-::1:1: Error: RawStmt: alternative is not implemented yet : 277
CREATE TABLE ctas_nodata_2 (ii, jj) AS SELECT i, j FROM ctas_base WITH NO DATA; -- OK
^
CREATE TABLE ctas_nodata_3 (ii) AS SELECT i, j FROM ctas_base; -- OK
-stdin-:: Error: Parse Sql
-stdin-::1:1: Error: RawStmt: alternative is not implemented yet : 277
CREATE TABLE ctas_nodata_3 (ii) AS SELECT i, j FROM ctas_base; -- OK
^
CREATE TABLE ctas_nodata_4 (ii) AS SELECT i, j FROM ctas_base WITH NO DATA; -- OK
-stdin-:: Error: Parse Sql
-stdin-::1:1: Error: RawStmt: alternative is not implemented yet : 277
CREATE TABLE ctas_nodata_4 (ii) AS SELECT i, j FROM ctas_base WITH NO DATA; -- OK
^
SELECT * FROM ctas_nodata;
-stdin-:: Fatal: Table metadata loading
-stdin-:: Fatal: ydb/library/yql/providers/yt/gateway/file/yql_yt_file_services.cpp:44: Table not found: plato.ctas_nodata
SELECT * FROM ctas_nodata_2;
-stdin-:: Fatal: Table metadata loading
-stdin-:: Fatal: ydb/library/yql/providers/yt/gateway/file/yql_yt_file_services.cpp:44: Table not found: plato.ctas_nodata_2
SELECT * FROM ctas_nodata_3;
-stdin-:: Fatal: Table metadata loading
-stdin-:: Fatal: ydb/library/yql/providers/yt/gateway/file/yql_yt_file_services.cpp:44: Table not found: plato.ctas_nodata_3
SELECT * FROM ctas_nodata_4;
-stdin-:: Fatal: Table metadata loading
-stdin-:: Fatal: ydb/library/yql/providers/yt/gateway/file/yql_yt_file_services.cpp:44: Table not found: plato.ctas_nodata_4
DROP TABLE ctas_base;
DROP TABLE ctas_nodata;
DROP TABLE ctas_nodata_2;
DROP TABLE ctas_nodata_3;
DROP TABLE ctas_nodata_4;
--
-- CREATE TABLE AS/SELECT INTO as last command in a SQL function
-- have been known to cause problems
--
CREATE FUNCTION make_table() RETURNS VOID
AS $$
CREATE TABLE created_table AS SELECT * FROM int8_tbl;
$$ LANGUAGE SQL;
-stdin-:: Error: Parse Sql
-stdin-::1:1: Error: RawStmt: alternative is not implemented yet : 261
--
^
SELECT make_table();
-stdin-:: Error: Type annotation
-stdin-::1:1: Error: At function: RemovePrefixMembers, At function: PgSelect, At function: PgSetItem, At function: PgResultItem
SELECT make_table();
^
-stdin-::1:8: Error: At function: PgCall
SELECT make_table();
^
-stdin-::1:8: Error: No such proc: make_table
SELECT make_table();
^
SELECT * FROM created_table;
-stdin-:: Fatal: Table metadata loading
-stdin-:: Fatal: ydb/library/yql/providers/yt/gateway/file/yql_yt_file_services.cpp:44: Table not found: plato.created_table
-- Try EXPLAIN ANALYZE SELECT INTO and EXPLAIN ANALYZE CREATE TABLE AS
-- WITH NO DATA, but hide the outputs since they won't be stable.
DO $$
BEGIN
EXECUTE 'EXPLAIN ANALYZE SELECT * INTO TABLE easi FROM int8_tbl';
EXECUTE 'EXPLAIN ANALYZE CREATE TABLE easi2 AS SELECT * FROM int8_tbl WITH NO DATA';
END$$;
-stdin-:: Error: Parse Sql
-stdin-::1:1: Error: RawStmt: alternative is not implemented yet : 263
-- Try EXPLAIN ANALYZE SELECT INTO and EXPLAIN ANALYZE CREATE TABLE AS
^
DROP TABLE created_table;
DROP TABLE easi, easi2;
--
-- Disallowed uses of SELECT ... INTO. All should fail
--
DECLARE foo CURSOR FOR SELECT 1 INTO b;
-stdin-:: Error: Parse Sql
-stdin-::1:1: Error: RawStmt: alternative is not implemented yet : 304
--
^
COPY (SELECT 1 INTO frak UNION SELECT 2) TO 'blob';
-stdin-:: Error: Parse Sql
-stdin-::1:1: Error: RawStmt: alternative is not implemented yet : 253
COPY (SELECT 1 INTO frak UNION SELECT 2) TO 'blob';
^
SELECT * FROM (SELECT 1 INTO f) bar;
-stdin-:: Error: Parse Sql
-stdin-::1:1: Error: SelectStmt: not supported intoClause
SELECT * FROM (SELECT 1 INTO f) bar;
^
-stdin-:: Error: Type annotation
-stdin-::1:1: Error: At function: RemovePrefixMembers, At function: PgSelect
SELECT * FROM (SELECT 1 INTO f) bar;
^
-stdin-::1:1: Error: Recursive query does not have the form non-recursive-term UNION [ALL] recursive-term
SELECT * FROM (SELECT 1 INTO f) bar;
^
CREATE VIEW foo AS SELECT 1 INTO b;
-stdin-:: Error: Parse Sql
-stdin-::1:1: Error: expected at least one target column
CREATE VIEW foo AS SELECT 1 INTO b;
^
INSERT INTO b SELECT 1 INTO f;
-stdin-:: Error: Parse Sql
-stdin-::1:1: Error: SelectStmt: not supported intoClause
INSERT INTO b SELECT 1 INTO f;
^
-- Test CREATE TABLE AS ... IF NOT EXISTS
CREATE TABLE ctas_ine_tbl AS SELECT 1;
-stdin-:: Error: Parse Sql
-stdin-::1:1: Error: RawStmt: alternative is not implemented yet : 277
-- Test CREATE TABLE AS ... IF NOT EXISTS
^
CREATE TABLE ctas_ine_tbl AS SELECT 1 / 0; -- error
-stdin-:: Error: Parse Sql
-stdin-::1:1: Error: RawStmt: alternative is not implemented yet : 277
CREATE TABLE ctas_ine_tbl AS SELECT 1 / 0; -- error
^
CREATE TABLE IF NOT EXISTS ctas_ine_tbl AS SELECT 1 / 0; -- ok
-stdin-:: Error: Parse Sql
-stdin-::1:1: Error: RawStmt: alternative is not implemented yet : 277
CREATE TABLE IF NOT EXISTS ctas_ine_tbl AS SELECT 1 / 0; -- ok
^
CREATE TABLE ctas_ine_tbl AS SELECT 1 / 0 WITH NO DATA; -- error
-stdin-:: Error: Parse Sql
-stdin-::1:1: Error: RawStmt: alternative is not implemented yet : 277
CREATE TABLE ctas_ine_tbl AS SELECT 1 / 0 WITH NO DATA; -- error
^
CREATE TABLE IF NOT EXISTS ctas_ine_tbl AS SELECT 1 / 0 WITH NO DATA; -- ok
-stdin-:: Error: Parse Sql
-stdin-::1:1: Error: RawStmt: alternative is not implemented yet : 277
CREATE TABLE IF NOT EXISTS ctas_ine_tbl AS SELECT 1 / 0 WITH NO DATA; -- ok
^
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
CREATE TABLE ctas_ine_tbl AS SELECT 1 / 0; -- error
-stdin-:: Error: Parse Sql
-stdin-::1:1: Error: RawStmt: alternative is not implemented yet : 276
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
^
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
CREATE TABLE IF NOT EXISTS ctas_ine_tbl AS SELECT 1 / 0; -- ok
-stdin-:: Error: Parse Sql
-stdin-::1:1: Error: RawStmt: alternative is not implemented yet : 276
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
^
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
CREATE TABLE ctas_ine_tbl AS SELECT 1 / 0 WITH NO DATA; -- error
-stdin-:: Error: Parse Sql
-stdin-::1:1: Error: RawStmt: alternative is not implemented yet : 276
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
^
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
CREATE TABLE IF NOT EXISTS ctas_ine_tbl AS SELECT 1 / 0 WITH NO DATA; -- ok
-stdin-:: Error: Parse Sql
-stdin-::1:1: Error: RawStmt: alternative is not implemented yet : 276
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
^
PREPARE ctas_ine_query AS SELECT 1 / 0;
-stdin-:: Error: Parse Sql
-stdin-::1:1: Error: RawStmt: alternative is not implemented yet : 301
PREPARE ctas_ine_query AS SELECT 1 / 0;
^
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
CREATE TABLE ctas_ine_tbl AS EXECUTE ctas_ine_query; -- error
-stdin-:: Error: Parse Sql
-stdin-::1:1: Error: RawStmt: alternative is not implemented yet : 276
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
^
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
CREATE TABLE IF NOT EXISTS ctas_ine_tbl AS EXECUTE ctas_ine_query; -- ok
-stdin-:: Error: Parse Sql
-stdin-::1:1: Error: RawStmt: alternative is not implemented yet : 276
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
^
DROP TABLE ctas_ine_tbl;