@@ -853,6 +853,171 @@ NOTICE: AFTER INSERTION TRIGGER ON TABLE storage_14 HAS EXPIRED. INSERTED ROW:
853
853
256 | 128 | test_inserts.storage_14
854
854
(27 rows)
855
855
856
+ /* test EXPLAIN (VERBOSE) - for PartitionFilter's targetlists */
857
+ EXPLAIN (VERBOSE, COSTS OFF)
858
+ INSERT INTO test_inserts.storage (b, d, e) SELECT i, i, i
859
+ FROM generate_series(1, 10) i
860
+ RETURNING e * 2, b, tableoid::regclass;
861
+ QUERY PLAN
862
+ -------------------------------------------------------------------------------
863
+ Insert on test_inserts.storage
864
+ Output: (storage.e * 2), storage.b, (storage.tableoid)::regclass
865
+ -> Custom Scan (PartitionFilter)
866
+ Output: NULL::integer, storage.b, NULL::integer, storage.d, storage.e
867
+ -> Function Scan on pg_catalog.generate_series i
868
+ Output: NULL::integer, i.i, NULL::integer, i.i, i.i
869
+ Function Call: generate_series(1, 10)
870
+ (7 rows)
871
+
872
+ EXPLAIN (VERBOSE, COSTS OFF)
873
+ INSERT INTO test_inserts.storage (d, e) SELECT i, i
874
+ FROM generate_series(1, 10) i;
875
+ QUERY PLAN
876
+ -------------------------------------------------------------------------------
877
+ Insert on test_inserts.storage
878
+ -> Custom Scan (PartitionFilter)
879
+ Output: NULL::integer, storage.b, NULL::integer, storage.d, storage.e
880
+ -> Function Scan on pg_catalog.generate_series i
881
+ Output: NULL::integer, NULL::integer, NULL::integer, i.i, i.i
882
+ Function Call: generate_series(1, 10)
883
+ (6 rows)
884
+
885
+ EXPLAIN (VERBOSE, COSTS OFF)
886
+ INSERT INTO test_inserts.storage (b) SELECT i
887
+ FROM generate_series(1, 10) i;
888
+ QUERY PLAN
889
+ -----------------------------------------------------------------------------------
890
+ Insert on test_inserts.storage
891
+ -> Custom Scan (PartitionFilter)
892
+ Output: NULL::integer, storage.b, NULL::integer, storage.d, storage.e
893
+ -> Function Scan on pg_catalog.generate_series i
894
+ Output: NULL::integer, i.i, NULL::integer, NULL::text, NULL::bigint
895
+ Function Call: generate_series(1, 10)
896
+ (6 rows)
897
+
898
+ EXPLAIN (VERBOSE, COSTS OFF)
899
+ INSERT INTO test_inserts.storage (b, d, e) SELECT b, d, e
900
+ FROM test_inserts.storage;
901
+ QUERY PLAN
902
+ ----------------------------------------------------------------------------------------------
903
+ Insert on test_inserts.storage
904
+ -> Custom Scan (PartitionFilter)
905
+ Output: NULL::integer, storage.b, NULL::integer, storage.d, storage.e
906
+ -> Result
907
+ Output: NULL::integer, storage_11.b, NULL::integer, storage_11.d, storage_11.e
908
+ -> Append
909
+ -> Seq Scan on test_inserts.storage_11
910
+ Output: storage_11.b, storage_11.d, storage_11.e
911
+ -> Seq Scan on test_inserts.storage_1
912
+ Output: storage_1.b, storage_1.d, storage_1.e
913
+ -> Seq Scan on test_inserts.storage_2
914
+ Output: storage_2.b, storage_2.d, storage_2.e
915
+ -> Seq Scan on test_inserts.storage_3
916
+ Output: storage_3.b, storage_3.d, storage_3.e
917
+ -> Seq Scan on test_inserts.storage_4
918
+ Output: storage_4.b, storage_4.d, storage_4.e
919
+ -> Seq Scan on test_inserts.storage_5
920
+ Output: storage_5.b, storage_5.d, storage_5.e
921
+ -> Seq Scan on test_inserts.storage_6
922
+ Output: storage_6.b, storage_6.d, storage_6.e
923
+ -> Seq Scan on test_inserts.storage_7
924
+ Output: storage_7.b, storage_7.d, storage_7.e
925
+ -> Seq Scan on test_inserts.storage_8
926
+ Output: storage_8.b, storage_8.d, storage_8.e
927
+ -> Seq Scan on test_inserts.storage_9
928
+ Output: storage_9.b, storage_9.d, storage_9.e
929
+ -> Seq Scan on test_inserts.storage_10
930
+ Output: storage_10.b, storage_10.d, storage_10.e
931
+ -> Seq Scan on test_inserts.storage_12
932
+ Output: storage_12.b, storage_12.d, storage_12.e
933
+ -> Seq Scan on test_inserts.storage_13
934
+ Output: storage_13.b, storage_13.d, storage_13.e
935
+ -> Seq Scan on test_inserts.storage_14
936
+ Output: storage_14.b, storage_14.d, storage_14.e
937
+ (34 rows)
938
+
939
+ EXPLAIN (VERBOSE, COSTS OFF)
940
+ INSERT INTO test_inserts.storage (b, d) SELECT b, d
941
+ FROM test_inserts.storage;
942
+ QUERY PLAN
943
+ ----------------------------------------------------------------------------------------------
944
+ Insert on test_inserts.storage
945
+ -> Custom Scan (PartitionFilter)
946
+ Output: NULL::integer, storage.b, NULL::integer, storage.d, storage.e
947
+ -> Result
948
+ Output: NULL::integer, storage_11.b, NULL::integer, storage_11.d, NULL::bigint
949
+ -> Append
950
+ -> Seq Scan on test_inserts.storage_11
951
+ Output: storage_11.b, storage_11.d
952
+ -> Seq Scan on test_inserts.storage_1
953
+ Output: storage_1.b, storage_1.d
954
+ -> Seq Scan on test_inserts.storage_2
955
+ Output: storage_2.b, storage_2.d
956
+ -> Seq Scan on test_inserts.storage_3
957
+ Output: storage_3.b, storage_3.d
958
+ -> Seq Scan on test_inserts.storage_4
959
+ Output: storage_4.b, storage_4.d
960
+ -> Seq Scan on test_inserts.storage_5
961
+ Output: storage_5.b, storage_5.d
962
+ -> Seq Scan on test_inserts.storage_6
963
+ Output: storage_6.b, storage_6.d
964
+ -> Seq Scan on test_inserts.storage_7
965
+ Output: storage_7.b, storage_7.d
966
+ -> Seq Scan on test_inserts.storage_8
967
+ Output: storage_8.b, storage_8.d
968
+ -> Seq Scan on test_inserts.storage_9
969
+ Output: storage_9.b, storage_9.d
970
+ -> Seq Scan on test_inserts.storage_10
971
+ Output: storage_10.b, storage_10.d
972
+ -> Seq Scan on test_inserts.storage_12
973
+ Output: storage_12.b, storage_12.d
974
+ -> Seq Scan on test_inserts.storage_13
975
+ Output: storage_13.b, storage_13.d
976
+ -> Seq Scan on test_inserts.storage_14
977
+ Output: storage_14.b, storage_14.d
978
+ (34 rows)
979
+
980
+ EXPLAIN (VERBOSE, COSTS OFF)
981
+ INSERT INTO test_inserts.storage (b) SELECT b
982
+ FROM test_inserts.storage;
983
+ QUERY PLAN
984
+ --------------------------------------------------------------------------------------------
985
+ Insert on test_inserts.storage
986
+ -> Custom Scan (PartitionFilter)
987
+ Output: NULL::integer, storage.b, NULL::integer, storage.d, storage.e
988
+ -> Result
989
+ Output: NULL::integer, storage_11.b, NULL::integer, NULL::text, NULL::bigint
990
+ -> Append
991
+ -> Seq Scan on test_inserts.storage_11
992
+ Output: storage_11.b
993
+ -> Seq Scan on test_inserts.storage_1
994
+ Output: storage_1.b
995
+ -> Seq Scan on test_inserts.storage_2
996
+ Output: storage_2.b
997
+ -> Seq Scan on test_inserts.storage_3
998
+ Output: storage_3.b
999
+ -> Seq Scan on test_inserts.storage_4
1000
+ Output: storage_4.b
1001
+ -> Seq Scan on test_inserts.storage_5
1002
+ Output: storage_5.b
1003
+ -> Seq Scan on test_inserts.storage_6
1004
+ Output: storage_6.b
1005
+ -> Seq Scan on test_inserts.storage_7
1006
+ Output: storage_7.b
1007
+ -> Seq Scan on test_inserts.storage_8
1008
+ Output: storage_8.b
1009
+ -> Seq Scan on test_inserts.storage_9
1010
+ Output: storage_9.b
1011
+ -> Seq Scan on test_inserts.storage_10
1012
+ Output: storage_10.b
1013
+ -> Seq Scan on test_inserts.storage_12
1014
+ Output: storage_12.b
1015
+ -> Seq Scan on test_inserts.storage_13
1016
+ Output: storage_13.b
1017
+ -> Seq Scan on test_inserts.storage_14
1018
+ Output: storage_14.b
1019
+ (34 rows)
1020
+
856
1021
/* test gap case (missing partition in between) */
857
1022
CREATE TABLE test_inserts.test_gap(val INT NOT NULL);
858
1023
INSERT INTO test_inserts.test_gap SELECT generate_series(1, 30);
0 commit comments