forked from openGauss-Ecosystem/openGauss-server
Compare commits
638 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
dde14c622e | |
|
|
93a1b93f40 | |
|
|
3246399eba | |
|
|
793e2ebf1a | |
|
|
7d9bb66972 | |
|
|
8b83bcdd2c | |
|
|
727e6ea941 | |
|
|
591e19db8d | |
|
|
cee4f486b3 | |
|
|
a94a50e30d | |
|
|
d639b6b943 | |
|
|
9e748bc12d | |
|
|
918d319bd1 | |
|
|
2468767828 | |
|
|
5dde94aeb4 | |
|
|
73f7d2f9b1 | |
|
|
34830d852d | |
|
|
b8ee37ad67 | |
|
|
ca5adff1b6 | |
|
|
8148d0a19d | |
|
|
efae2abdc9 | |
|
|
85748e3c12 | |
|
|
00eaec99a3 | |
|
|
cb4bb56d8d | |
|
|
946165b8cb | |
|
|
432cc6d43a | |
|
|
dd853ba943 | |
|
|
37de345c9c | |
|
|
1443f58545 | |
|
|
3cf655f35f | |
|
|
b1e88debe4 | |
|
|
227264f32a | |
|
|
f358576f8b | |
|
|
4b47cabb2b | |
|
|
58e6120553 | |
|
|
7a66efc41b | |
|
|
bf4e1d616d | |
|
|
dcdd67aad7 | |
|
|
5b6c28fe84 | |
|
|
c47f5a09d4 | |
|
|
7b3c0feadd | |
|
|
16f8644c9b | |
|
|
93b27dc49f | |
|
|
af36f2ac52 | |
|
|
409e828445 | |
|
|
fc26506099 | |
|
|
eb020174a8 | |
|
|
4b8cfc0f1a | |
|
|
66a0e4f347 | |
|
|
40c11d8fa8 | |
|
|
9f8064bb24 | |
|
|
5a69c46920 | |
|
|
195e9d58c3 | |
|
|
cd12ea624e | |
|
|
b8538ddcfb | |
|
|
d0b095c505 | |
|
|
4e461e3ffb | |
|
|
672a03e1c5 | |
|
|
449de3d407 | |
|
|
d4c6baf3f2 | |
|
|
022391dab6 | |
|
|
2f380bcdb0 | |
|
|
4a4cae7bf8 | |
|
|
a54c0c8f4b | |
|
|
597f69d7a4 | |
|
|
20b5a1f9f4 | |
|
|
d95ff6d974 | |
|
|
4352632534 | |
|
|
4180f34b3d | |
|
|
8c9b36a9d8 | |
|
|
8cd82a12c5 | |
|
|
e134f38892 | |
|
|
f7a4a90e93 | |
|
|
575169c0e6 | |
|
|
55fb931a8e | |
|
|
b37d669f16 | |
|
|
9ca77f6327 | |
|
|
633add65a5 | |
|
|
ed24b4dd2a | |
|
|
cb69338a83 | |
|
|
73d540c750 | |
|
|
36b42f0507 | |
|
|
baedc3ab1e | |
|
|
60b367a940 | |
|
|
9e57ff3e8e | |
|
|
2815152fe1 | |
|
|
70f464b44d | |
|
|
6bbae768f1 | |
|
|
1b8ab5a2e2 | |
|
|
cae89236d1 | |
|
|
41078c951a | |
|
|
62d9aa7012 | |
|
|
34f759c327 | |
|
|
d0626058b8 | |
|
|
0ffb3f47a0 | |
|
|
5f7ad14378 | |
|
|
bb7cffcc3b | |
|
|
728bb6933b | |
|
|
fc7032535f | |
|
|
0126ddc59d | |
|
|
3541b757bd | |
|
|
9363717384 | |
|
|
3fee79a080 | |
|
|
ad1a3b25d7 | |
|
|
1f6090e30e | |
|
|
f7d23913d6 | |
|
|
7d1c911b5c | |
|
|
2273500060 | |
|
|
a7eacafade | |
|
|
6bb6c98613 | |
|
|
26e959b405 | |
|
|
add392eb9a | |
|
|
6db88b785b | |
|
|
a10741b11e | |
|
|
210b3aa814 | |
|
|
2f59d8c81c | |
|
|
2114241085 | |
|
|
a2baa2d934 | |
|
|
404cd52cd1 | |
|
|
8e20244935 | |
|
|
5b5e66910b | |
|
|
0562c038b8 | |
|
|
a349da1ca3 | |
|
|
ab40a11cd1 | |
|
|
3d61862de9 | |
|
|
3bc9cc5f7d | |
|
|
baf70db8f4 | |
|
|
157d1f141e | |
|
|
cbd9538757 | |
|
|
b590711499 | |
|
|
d1b7965c06 | |
|
|
0853225018 | |
|
|
c4187161ec | |
|
|
c85182e24c | |
|
|
44135e2340 | |
|
|
d326c9ef54 | |
|
|
f041cf508e | |
|
|
a71786ee1c | |
|
|
1b885087e7 | |
|
|
d11f5b12ac | |
|
|
f00f5e10f8 | |
|
|
dee734479a | |
|
|
49eae2eb2c | |
|
|
e62c1b5080 | |
|
|
548a2950a6 | |
|
|
8ecf040d21 | |
|
|
7012d53d76 | |
|
|
96a8d00342 | |
|
|
adbb73b632 | |
|
|
7db0daa08d | |
|
|
45c965e4f0 | |
|
|
911ea39bea | |
|
|
9f84893535 | |
|
|
fd1f338af5 | |
|
|
c3e3237fe0 | |
|
|
d5922c6a7e | |
|
|
ddccb0aea5 | |
|
|
a7e70728e4 | |
|
|
04aba45854 | |
|
|
5761b22869 | |
|
|
f854dfb0c5 | |
|
|
a1c285af1d | |
|
|
a163a0aa81 | |
|
|
7aa62090e7 | |
|
|
1c0426da86 | |
|
|
b40c3ffd7f | |
|
|
2b6bc9e490 | |
|
|
017d7dc0a5 | |
|
|
4ce106922c | |
|
|
913c0e2fd3 | |
|
|
d1c46bb20f | |
|
|
e08956f596 | |
|
|
2314f1c9cf | |
|
|
d9f1f30ae0 | |
|
|
b768b63576 | |
|
|
67dd64aa1b | |
|
|
e6e765493e | |
|
|
ec4c0de649 | |
|
|
5988b0d1dc | |
|
|
e88cef70c1 | |
|
|
c8bd22a470 | |
|
|
9929f73f0c | |
|
|
c47ffdc137 | |
|
|
707b72e2ce | |
|
|
f427d6a2ee | |
|
|
58f804b16d | |
|
|
c0be30e0e3 | |
|
|
6d2b1fbdb0 | |
|
|
2c54c67394 | |
|
|
ba442ff864 | |
|
|
8e894cc3f1 | |
|
|
7e7564950a | |
|
|
c15d34220b | |
|
|
688db7b48b | |
|
|
c9baf1bd5b | |
|
|
f7453c1b8d | |
|
|
a3ce762af9 | |
|
|
d7420c2caf | |
|
|
b597501595 | |
|
|
b7c6ae6ac0 | |
|
|
0387492fed | |
|
|
5fa81bb4ec | |
|
|
c59b22d73f | |
|
|
3a995f97e6 | |
|
|
76d2924502 | |
|
|
72318f22ba | |
|
|
ca299a3b9b | |
|
|
1c5977ee03 | |
|
|
3f2da96ef6 | |
|
|
157095553c | |
|
|
0140f8d9f4 | |
|
|
ae4379f8a4 | |
|
|
decca5a547 | |
|
|
dff7dc06c5 | |
|
|
da54d69be9 | |
|
|
3dac2a636a | |
|
|
ddd104c596 | |
|
|
52dd7bc750 | |
|
|
a216c40a78 | |
|
|
9d042874a6 | |
|
|
4d3d277e4e | |
|
|
2e6ea6fd6c | |
|
|
1ab1d8fb8c | |
|
|
7ba1b5ace1 | |
|
|
9b4c93183a | |
|
|
229f58f82c | |
|
|
3154c5a3b2 | |
|
|
7f9abdab10 | |
|
|
ad8b8ebae2 | |
|
|
2a4045fbca | |
|
|
8e4a129c9b | |
|
|
7d8eb9c1eb | |
|
|
a00323d24b | |
|
|
3b73572c0f | |
|
|
997b73e6e5 | |
|
|
abcd3e6d1c | |
|
|
fde67e6c8b | |
|
|
d913fac413 | |
|
|
c77d27b515 | |
|
|
13d461869b | |
|
|
ed4d38e6f3 | |
|
|
0613f8eedd | |
|
|
28fa2ea9d2 | |
|
|
a269bc1879 | |
|
|
ab2770058c | |
|
|
c81eaed21c | |
|
|
4206ad5258 | |
|
|
9186031f99 | |
|
|
c46c2b307b | |
|
|
8e1ab60a33 | |
|
|
67ea04610e | |
|
|
1d05bff955 | |
|
|
78ea45ca13 | |
|
|
bf0506a1eb | |
|
|
aa27f6ccc4 | |
|
|
018162771f | |
|
|
8cec403fac | |
|
|
5091b95a60 | |
|
|
b17472efe8 | |
|
|
dcdc9101ab | |
|
|
39c2d3eeef | |
|
|
d94dc71271 | |
|
|
7e8e9de6a2 | |
|
|
7c60335e24 | |
|
|
70d832ed9f | |
|
|
214297acef | |
|
|
39a27de267 | |
|
|
08982ec182 | |
|
|
fd79300905 | |
|
|
8d5b8af09c | |
|
|
8dd624aff8 | |
|
|
939cdc8855 | |
|
|
c69efe24e4 | |
|
|
3435e4fc9b | |
|
|
2b0c6e1870 | |
|
|
b2b4ee913c | |
|
|
81646fb183 | |
|
|
a3f544a28a | |
|
|
4918e0f7ec | |
|
|
addf3145ff | |
|
|
7ac947b7c3 | |
|
|
14542b84e7 | |
|
|
6639c84dcd | |
|
|
4f3505328f | |
|
|
e9f29064dd | |
|
|
3ba06d6995 | |
|
|
dfe74a3630 | |
|
|
1d57ca36ad | |
|
|
6ce57b1f10 | |
|
|
49dd399971 | |
|
|
9ffe8a74d3 | |
|
|
053aadfa38 | |
|
|
ed3d27a228 | |
|
|
a0498a5701 | |
|
|
a9c3b8aaad | |
|
|
266a7c0f23 | |
|
|
83c42e025c | |
|
|
8e889c3580 | |
|
|
cc567d77f8 | |
|
|
1d369d673d | |
|
|
e88d61db72 | |
|
|
0248a0915d | |
|
|
38fbc348e9 | |
|
|
acb6439192 | |
|
|
a49fe42310 | |
|
|
57d53542c5 | |
|
|
d910ee9d7d | |
|
|
4b01d2fcdd | |
|
|
03439a28ed | |
|
|
017c9329f8 | |
|
|
1276c3af87 | |
|
|
57ed20e0c7 | |
|
|
6d4cfc8074 | |
|
|
4a46a8b01f | |
|
|
85b82c5d63 | |
|
|
a8bace43ed | |
|
|
fd1efa9d41 | |
|
|
a166122e2a | |
|
|
ae9161f30b | |
|
|
6a8b208831 | |
|
|
48193b6c39 | |
|
|
5aa5ef9406 | |
|
|
6e4d1695c3 | |
|
|
5e89b830ea | |
|
|
8151036ef1 | |
|
|
5371d0d06b | |
|
|
95a55bfd2b | |
|
|
bce67e3981 | |
|
|
d1a82a168c | |
|
|
b2a5d20e8b | |
|
|
903ad22881 | |
|
|
b6c9289c28 | |
|
|
952316ac44 | |
|
|
a06722de46 | |
|
|
b5ad4c2b99 | |
|
|
c63fa868a4 | |
|
|
a594de56a2 | |
|
|
2c420738c8 | |
|
|
a504ddfca4 | |
|
|
2fb6d4321e | |
|
|
205274dc7a | |
|
|
aac1c3b0c0 | |
|
|
2e319d7c34 | |
|
|
b379970732 | |
|
|
de3891c54e | |
|
|
5ef3bc90a3 | |
|
|
0c6d9a88a9 | |
|
|
c5aa3fa255 | |
|
|
396d15ee5a | |
|
|
37177fdf62 | |
|
|
9036e64955 | |
|
|
aaff16b088 | |
|
|
e2c37735de | |
|
|
be1ac1dee9 | |
|
|
bd74fed434 | |
|
|
b658f54c31 | |
|
|
cbb5b4fe37 | |
|
|
6a29713e6d | |
|
|
ee1e3b25fe | |
|
|
98cbf84e7f | |
|
|
30b4e5c253 | |
|
|
0b8e1fcf82 | |
|
|
d465c8fecf | |
|
|
ded16a65b4 | |
|
|
2313bec17e | |
|
|
eee21b1180 | |
|
|
f984b85ce6 | |
|
|
dc671f1cea | |
|
|
50ed45f280 | |
|
|
e130660c6a | |
|
|
b5dc67ccdb | |
|
|
500d43fd7a | |
|
|
66c2ca3481 | |
|
|
a80de88a0f | |
|
|
fc359a7d90 | |
|
|
2e4f56c422 | |
|
|
b80bcf9eb5 | |
|
|
713da47bf5 | |
|
|
2e760ad0ee | |
|
|
bec5136b6a | |
|
|
d6b75f5fc6 | |
|
|
9cc27bc424 | |
|
|
7946661d31 | |
|
|
9e6b14bd1c | |
|
|
93677e4261 | |
|
|
d2cbd2bfc0 | |
|
|
9203452e00 | |
|
|
2458165e05 | |
|
|
272de26f63 | |
|
|
e213cad320 | |
|
|
9889e4edec | |
|
|
22ec06468a | |
|
|
3ffa07e987 | |
|
|
540298301c | |
|
|
187ef591d7 | |
|
|
826bddb3a6 | |
|
|
9e9a30ae7a | |
|
|
c8913da1e5 | |
|
|
a3e2f50179 | |
|
|
151f38670c | |
|
|
ee12972524 | |
|
|
353ed2248a | |
|
|
276c86eebc | |
|
|
273bab793d | |
|
|
492a17d205 | |
|
|
66242b6844 | |
|
|
b07afd5c66 | |
|
|
6c51a4b230 | |
|
|
b635f0aa19 | |
|
|
e7ff8013f6 | |
|
|
5da26aaca3 | |
|
|
211353e5ab | |
|
|
60b789535f | |
|
|
ba3ff0446e | |
|
|
12ec2ab34c | |
|
|
14612cfaf0 | |
|
|
0ad8e3b944 | |
|
|
d66dbc1ece | |
|
|
2217e1eec8 | |
|
|
4a2383375d | |
|
|
3a24ebbc61 | |
|
|
1e1fbf2c99 | |
|
|
a4ee5b26b6 | |
|
|
31cec9afc3 | |
|
|
709801983e | |
|
|
929d416846 | |
|
|
0800cec028 | |
|
|
8763f363f1 | |
|
|
30c251bb0a | |
|
|
3f30b9f992 | |
|
|
0dda70971c | |
|
|
50502f0c78 | |
|
|
394de98564 | |
|
|
f1fe8cf4dc | |
|
|
ed6dc5f3fc | |
|
|
d8b7f4ab74 | |
|
|
357aa8fccd | |
|
|
da120693c6 | |
|
|
527df86513 | |
|
|
97521070b7 | |
|
|
f352beb8b1 | |
|
|
76e1753640 | |
|
|
d305926560 | |
|
|
73993b6e72 | |
|
|
b7578a6751 | |
|
|
f65d34d779 | |
|
|
cd43fd54aa | |
|
|
6ed7974808 | |
|
|
6322b41b89 | |
|
|
42c3e1f30d | |
|
|
4b2792814a | |
|
|
1afe404b40 | |
|
|
3c5ecbf300 | |
|
|
4b1fce8060 | |
|
|
bca6e9ece5 | |
|
|
a361d8f4a3 | |
|
|
0762036bb3 | |
|
|
3c0927c7e2 | |
|
|
e1c10dafb4 | |
|
|
437d1ff9bd | |
|
|
70e850a384 | |
|
|
e5c2b913ba | |
|
|
fefebd6a20 | |
|
|
73cff1dff0 | |
|
|
a1c04c6c39 | |
|
|
cc44099d9e | |
|
|
26a5210b41 | |
|
|
a7f1f09950 | |
|
|
ccd860bff7 | |
|
|
1308658189 | |
|
|
3b89a69792 | |
|
|
c5a2b63704 | |
|
|
8d57f28cb1 | |
|
|
92de5dcb69 | |
|
|
fabaac505c | |
|
|
75639bc960 | |
|
|
aef96219b4 | |
|
|
d65919d4b9 | |
|
|
255c419497 | |
|
|
d627bdff4e | |
|
|
f52b872535 | |
|
|
11b4e24959 | |
|
|
02f5afd2e0 | |
|
|
ee3b7bcb4c | |
|
|
c843c345be | |
|
|
ea4f17cc42 | |
|
|
c1119fa4ac | |
|
|
7620f26d8a | |
|
|
8190bf4ae9 | |
|
|
a0fc99d621 | |
|
|
b2cac28597 | |
|
|
09b568993d | |
|
|
211c7d7e68 | |
|
|
aef0b4dbaf | |
|
|
6dfbb15ab5 | |
|
|
c617e92d9b | |
|
|
14d546cc39 | |
|
|
33f90f64e6 | |
|
|
12ad305548 | |
|
|
5774e2ff85 | |
|
|
ec5bd2ce9d | |
|
|
7ed23d0b31 | |
|
|
3141e7839e | |
|
|
c68e1a37ed | |
|
|
708502e97d | |
|
|
547d64b3a8 | |
|
|
9a1511fa4c | |
|
|
785a596df1 | |
|
|
7a4ed428c2 | |
|
|
fc654ee8e5 | |
|
|
315b44113c | |
|
|
5927d3111a | |
|
|
7ff965f389 | |
|
|
7d96b40168 | |
|
|
1dc6f1f812 | |
|
|
ef6a53180d | |
|
|
e65c837077 | |
|
|
0651593f81 | |
|
|
569e6cc149 | |
|
|
b958f950bf | |
|
|
baa013bfe1 | |
|
|
c72e49f563 | |
|
|
99e4f7ff09 | |
|
|
d2d86be171 | |
|
|
a5fb68a3a2 | |
|
|
3b4ed0988d | |
|
|
b79da29a94 | |
|
|
8c80ce6dd8 | |
|
|
c4ea9be231 | |
|
|
95f017db04 | |
|
|
16bed4d95b | |
|
|
63f962adb7 | |
|
|
7278436817 | |
|
|
152c407512 | |
|
|
88575eae03 | |
|
|
b15c245a18 | |
|
|
5d56e686e6 | |
|
|
1b6bf1b848 | |
|
|
412ef0a1af | |
|
|
1b97274b24 | |
|
|
7924440a6d | |
|
|
91d9ef5e12 | |
|
|
d58ebf08df | |
|
|
21d6ae2954 | |
|
|
cc86d9efb9 | |
|
|
a411cc302f | |
|
|
05a98eccc2 | |
|
|
f6483f4369 | |
|
|
b79274bcc5 | |
|
|
9b59521509 | |
|
|
dfc46c5916 | |
|
|
c950de5f36 | |
|
|
cd613855bf | |
|
|
15ac32a9c7 | |
|
|
1a417078d1 | |
|
|
d8efa2c50f | |
|
|
5c29e59612 | |
|
|
f6cd9da230 | |
|
|
84a4884373 | |
|
|
a28e49918d | |
|
|
05d7b74e31 | |
|
|
c98b1f6299 | |
|
|
e989a7c515 | |
|
|
2b59dba0e9 | |
|
|
aaaddb18a5 | |
|
|
c3eb405592 | |
|
|
9d9fd46e69 | |
|
|
baca9249e1 | |
|
|
4ddebd5c2d | |
|
|
2f9e6e1fe4 | |
|
|
e73020e2b7 | |
|
|
8b19fc7972 | |
|
|
1d11fc5ba2 | |
|
|
0ccdf5dd95 | |
|
|
2d767f5756 | |
|
|
deedcc4bdd | |
|
|
689c0d8783 | |
|
|
7d95ebaf34 | |
|
|
6bc9c3930b | |
|
|
7b2c39af14 | |
|
|
6fe074f4a1 | |
|
|
36bfa3239a | |
|
|
95321a2a6e | |
|
|
eaa6361795 | |
|
|
dfca92aebe | |
|
|
afc29ca14d | |
|
|
e1da7bcc48 | |
|
|
adc8364212 | |
|
|
b52a75d25a | |
|
|
1ec89d5a2c | |
|
|
0238d80fee | |
|
|
d611aaa7f3 | |
|
|
092f458655 | |
|
|
3787c02557 | |
|
|
9318cd8b1f | |
|
|
9cee00b918 | |
|
|
a8dd3ece1f | |
|
|
183a62fe66 | |
|
|
9efa654873 | |
|
|
5a43e77784 | |
|
|
529d6f2dd6 | |
|
|
417e617fee | |
|
|
c804e82b84 | |
|
|
1fab996fc4 | |
|
|
5d4ad6ccea | |
|
|
6a35d51d42 | |
|
|
6289b1965d | |
|
|
3de7b7709f | |
|
|
29793c51c1 | |
|
|
059ad05d7b | |
|
|
6c87699fa9 | |
|
|
25eba6cc8e | |
|
|
a9ccc5de65 | |
|
|
54d0336182 | |
|
|
54c43934af | |
|
|
79c1558523 | |
|
|
4b98847600 | |
|
|
041e899d78 | |
|
|
d951407620 | |
|
|
97bc7cd191 | |
|
|
0d516a27d1 | |
|
|
1a4ec792e8 | |
|
|
ecf954899d | |
|
|
6412f131ab | |
|
|
2ac8c7df7c | |
|
|
8dca586a5a | |
|
|
6513ff0aae | |
|
|
1b4021b43d | |
|
|
f08b471229 | |
|
|
17bb950da8 | |
|
|
c12a8681ca | |
|
|
13606147e4 | |
|
|
5367ca6737 | |
|
|
f8ec465f1f | |
|
|
9695ccd722 | |
|
|
71755991b2 | |
|
|
ab3d6c1bb1 | |
|
|
7bb9a3d35b |
|
|
@ -16,7 +16,8 @@
|
|||
1. 请附上自验结果(内容或者截图)
|
||||
2. 是否可以添加fastcheck测试用例,如是,请补充fastcheck用例
|
||||
3. 是否涉及资料修改,如是,在docs仓库补充资料
|
||||
4. 是否考虑支撑升级和在线扩容等扩展场景
|
||||
4. 是否考虑升级场景(系统表修改、日志持久化以及修改执行态数据格式)
|
||||
5. 是否考虑在线扩容等扩展场景
|
||||
5. 是否考虑异常场景/并发场景/前向兼容/性能场景
|
||||
6. 是否对其他模块产生影响
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
[submodule "openGauss-Custom-function"]
|
||||
path = openGauss-Custom-function
|
||||
url = ../openGauss-Custom-function.git
|
||||
[submodule "openGauss-Query-select"]
|
||||
path = openGauss-Query-select
|
||||
url = ../openGauss-Query-select.git
|
||||
[submodule "openGauss-Security-control"]
|
||||
path = openGauss-Security-control
|
||||
url = ../openGauss-Security-control.git
|
||||
[submodule "openGauss-Stored-Procedure"]
|
||||
path = openGauss-Stored-Procedure
|
||||
url = ../openGauss-Stored-Procedure.git
|
||||
[submodule "openGauss-basic-operation"]
|
||||
path = openGauss-basic-operation
|
||||
url = ../openGauss-basic-operation.git
|
||||
[submodule "openGauss-transaction"]
|
||||
path = openGauss-transaction
|
||||
url = ../openGauss-transaction.git
|
||||
[submodule "openGauss-trigger"]
|
||||
path = openGauss-trigger
|
||||
url = ../openGauss-trigger.git
|
||||
[submodule "openGauss-competition"]
|
||||
path = openGauss-competition
|
||||
url = ../openGauss-competition.git
|
||||
|
|
@ -93,6 +93,7 @@ install:
|
|||
$(MAKE) install_pldebugger
|
||||
$(MAKE) -C contrib/postgres_fdw $@
|
||||
$(MAKE) -C contrib/hstore $@
|
||||
$(MAKE) -C contrib/dblink $@
|
||||
@if test -d contrib/dolphin; then $(MAKE) -C contrib/dolphin $@; fi
|
||||
+@echo "openGauss installation complete."
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -414,6 +414,8 @@ https://opengauss.org/zh/
|
|||
| 2.1.0 | https://opengauss.obs.cn-south-1.myhuaweicloud.com/2.1.0/openGauss-third_party_binarylibs.tar.gz |
|
||||
| 3.0.0 | https://opengauss.obs.cn-south-1.myhuaweicloud.com/3.0.0/openGauss-third_party_binarylibs.tar.gz |
|
||||
| 3.1.0 | **openEuler_arm:** https://opengauss.obs.cn-south-1.myhuaweicloud.com/latest/binarylibs/openGauss-third_party_binarylibs_openEuler_arm.tar.gz <br/> **openEuler_x86:** https://opengauss.obs.cn-south-1.myhuaweicloud.com/latest/binarylibs/openGauss-third_party_binarylibs_openEuler_x86_64.tar.gz<br/> **Centos_x86:** https://opengauss.obs.cn-south-1.myhuaweicloud.com/latest/binarylibs/openGauss-third_party_binarylibs_Centos7.6_x86_64.tar.gz |
|
||||
| 3.1.1 | **openEuler_arm:** https://opengauss.obs.cn-south-1.myhuaweicloud.com/3.1.1/binarylibs/openGauss-third_party_binarylibs_openEuler_arm.tar.gz <br/> **openEuler_x86:** https://opengauss.obs.cn-south-1.myhuaweicloud.com/3.1.1/binarylibs/openGauss-third_party_binarylibs_openEuler_x86_64.tar.gz<br/> **Centos_x86:** https://opengauss.obs.cn-south-1.myhuaweicloud.com/3.1.1/binarylibs/openGauss-third_party_binarylibs_Centos7.6_x86_64.tar.gz |
|
||||
| 5.0.0 | **openEuler_arm:** https://opengauss.obs.cn-south-1.myhuaweicloud.com/5.0.0/binarylibs/openGauss-third_party_binarylibs_openEuler_arm.tar.gz <br/> **openEuler_x86:** https://opengauss.obs.cn-south-1.myhuaweicloud.com/5.0.0/binarylibs/openGauss-third_party_binarylibs_openEuler_x86_64.tar.gz<br/> **Centos_x86:** https://opengauss.obs.cn-south-1.myhuaweicloud.com/5.0.0/binarylibs/openGauss-third_party_binarylibs_Centos7.6_x86_64.tar.gz |
|
||||
| master | **openEuler_arm:** https://opengauss.obs.cn-south-1.myhuaweicloud.com/latest/binarylibs/openGauss-third_party_binarylibs_openEuler_arm.tar.gz <br/> **openEuler_x86:** https://opengauss.obs.cn-south-1.myhuaweicloud.com/latest/binarylibs/openGauss-third_party_binarylibs_openEuler_x86_64.tar.gz<br/> **Centos_x86:** https://opengauss.obs.cn-south-1.myhuaweicloud.com/latest/binarylibs/openGauss-third_party_binarylibs_Centos7.6_x86_64.tar.gz |
|
||||
|
||||
现在我们已经拥有完整的openGauss代码,把它存储在以下目录中(以sda为例)。
|
||||
|
|
|
|||
|
|
@ -904,4 +904,4 @@
|
|||
./include/pqcomm.h
|
||||
./include/pqexpbuffer.h
|
||||
[version]
|
||||
3.1.0
|
||||
5.0.0
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@
|
|||
./bin/kadmin.local
|
||||
./bin/lz4
|
||||
./bin/kadmind
|
||||
./bin/dbmind
|
||||
./bin/gs_dbmind
|
||||
./bin/constant
|
||||
./bin/server.key.cipher
|
||||
|
|
@ -84,6 +83,9 @@
|
|||
./share/postgresql/extension/mot_fdw.control
|
||||
./share/postgresql/extension/postgres_fdw--1.0.sql
|
||||
./share/postgresql/extension/postgres_fdw.control
|
||||
./share/postgresql/extension/dblink--1.0.sql
|
||||
./share/postgresql/extension/dblink--unpackaged--1.0.sql
|
||||
./share/postgresql/extension/dblink.control
|
||||
./share/postgresql/timezone/GB-Eire
|
||||
./share/postgresql/timezone/Turkey
|
||||
./share/postgresql/timezone/Kwajalein
|
||||
|
|
@ -758,6 +760,7 @@
|
|||
./lib/postgresql/pg_upgrade_support.so
|
||||
./lib/postgresql/java/pljava.jar
|
||||
./lib/postgresql/postgres_fdw.so
|
||||
./lib/postgresql/dblink.so
|
||||
./lib/postgresql/pgoutput.so
|
||||
./lib/libpljava.so
|
||||
./lib/libpq.a
|
||||
|
|
@ -832,6 +835,7 @@
|
|||
./lib/libpagecompression.so*
|
||||
./lib/libdssapi.so
|
||||
./lib/libdms.so
|
||||
./lib/libodbc.so*
|
||||
|
||||
./include/postgresql/server/postgres_ext.h
|
||||
./include/postgresql/server/pg_config_os.h
|
||||
|
|
|
|||
|
|
@ -442,6 +442,7 @@ function install_gaussdb()
|
|||
export BUILD_TUPLE=${PLATFORM_ARCH}
|
||||
export THIRD_BIN_PATH="${binarylibs_path}"
|
||||
export PREFIX_HOME="${BUILD_DIR}"
|
||||
export ENABLE_LITE_MODE=ON
|
||||
|
||||
if [ "$version_mode"x == "release"x ]; then
|
||||
CMAKE_OPT="-DENABLE_MULTIPLE_NODES=OFF -DENABLE_PRIVATEGAUSS=OFF -DENABLE_THREAD_SAFETY=ON -DENABLE_LITE_MODE=ON"
|
||||
|
|
@ -454,6 +455,10 @@ function install_gaussdb()
|
|||
export DEBUG_TYPE=debug
|
||||
fi
|
||||
|
||||
if [[ -e "/etc/openEuler-release" && "$(cat /etc/openEuler-release | awk '{print $3}')" == "22.03" ]]; then
|
||||
CMAKE_OPT="$CMAKE_OPT -DENABLE_OPENEULER_MAJOR=ON"
|
||||
fi
|
||||
echo "CMAKE_OPT----> $CMAKE_OPT"
|
||||
echo "Begin run cmake for gaussdb server" >> "$LOG_FILE" 2>&1
|
||||
echo "CMake options: ${CMAKE_OPT}" >> "$LOG_FILE" 2>&1
|
||||
echo "CMake release: ${DEBUG_TYPE}" >> "$LOG_FILE" 2>&1
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
PRODUCT=openGauss
|
||||
VERSION=3.1.0
|
||||
VERSION=5.0.0
|
||||
|
|
@ -38,7 +38,6 @@
|
|||
./bin/kadmin.local
|
||||
./bin/lz4
|
||||
./bin/kadmind
|
||||
./bin/dbmind
|
||||
./bin/server.key.cipher
|
||||
./bin/server.key.rand
|
||||
./etc/kerberos/kadm5.acl
|
||||
|
|
@ -80,6 +79,9 @@
|
|||
./share/postgresql/extension/gsredistribute--unpackaged--1.0.sql
|
||||
./share/postgresql/extension/postgres_fdw--1.0.sql
|
||||
./share/postgresql/extension/postgres_fdw.control
|
||||
./share/postgresql/extension/dblink--1.0.sql
|
||||
./share/postgresql/extension/dblink--unpackaged--1.0.sql
|
||||
./share/postgresql/extension/dblink.control
|
||||
./share/postgresql/timezone/GB-Eire
|
||||
./share/postgresql/timezone/Turkey
|
||||
./share/postgresql/timezone/Kwajalein
|
||||
|
|
@ -753,6 +755,7 @@
|
|||
./lib/postgresql/pg_upgrade_support.so
|
||||
./lib/postgresql/java/pljava.jar
|
||||
./lib/postgresql/postgres_fdw.so
|
||||
./lib/postgresql/dblink.so
|
||||
./lib/libpljava.so
|
||||
./lib/libpq.a
|
||||
./lib/libpq.so
|
||||
|
|
@ -881,6 +884,7 @@
|
|||
./lib/postgresql/latin2_and_win1250.so
|
||||
./lib/postgresql/euc2004_sjis2004.so
|
||||
./lib/libhll.so
|
||||
./lib/libodbc.so*
|
||||
|
||||
./include/postgresql/server/postgres_ext.h
|
||||
./include/postgresql/server/pg_config_os.h
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
./bin/kadmin.local
|
||||
./bin/lz4
|
||||
./bin/kadmind
|
||||
./bin/dbmind
|
||||
./bin/gs_dbmind
|
||||
./bin/server.key.cipher
|
||||
./bin/server.key.rand
|
||||
./bin/gs_plan_simulator.sh
|
||||
|
|
@ -82,6 +82,9 @@
|
|||
./share/postgresql/extension/gsredistribute--unpackaged--1.0.sql
|
||||
./share/postgresql/extension/postgres_fdw--1.0.sql
|
||||
./share/postgresql/extension/postgres_fdw.control
|
||||
./share/postgresql/extension/dblink--1.0.sql
|
||||
./share/postgresql/extension/dblink--unpackaged--1.0.sql
|
||||
./share/postgresql/extension/dblink.control
|
||||
./share/postgresql/timezone/GB-Eire
|
||||
./share/postgresql/timezone/Turkey
|
||||
./share/postgresql/timezone/Kwajalein
|
||||
|
|
@ -755,6 +758,7 @@
|
|||
./lib/postgresql/pg_upgrade_support.so
|
||||
./lib/postgresql/java/pljava.jar
|
||||
./lib/postgresql/postgres_fdw.so
|
||||
./lib/postgresql/dblink.so
|
||||
./lib/libpljava.so
|
||||
./lib/libpq.a
|
||||
./lib/libpq.so
|
||||
|
|
@ -883,6 +887,7 @@
|
|||
./lib/postgresql/latin2_and_win1250.so
|
||||
./lib/postgresql/euc2004_sjis2004.so
|
||||
./lib/libhll.so
|
||||
./lib/libodbc.so*
|
||||
|
||||
./include/postgresql/server/postgres_ext.h
|
||||
./include/postgresql/server/pg_config_os.h
|
||||
|
|
|
|||
|
|
@ -903,4 +903,4 @@
|
|||
./include/pqcomm.h
|
||||
./include/pqexpbuffer.h
|
||||
[version]
|
||||
3.1.0
|
||||
5.0.0
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@
|
|||
./bin/kadmin.local
|
||||
./bin/lz4
|
||||
./bin/kadmind
|
||||
./bin/dbmind
|
||||
./bin/gs_dbmind
|
||||
./bin/constant
|
||||
./bin/server.key.cipher
|
||||
|
|
@ -84,6 +83,9 @@
|
|||
./share/postgresql/extension/mot_fdw.control
|
||||
./share/postgresql/extension/postgres_fdw--1.0.sql
|
||||
./share/postgresql/extension/postgres_fdw.control
|
||||
./share/postgresql/extension/dblink--1.0.sql
|
||||
./share/postgresql/extension/dblink--unpackaged--1.0.sql
|
||||
./share/postgresql/extension/dblink.control
|
||||
./share/postgresql/timezone/GB-Eire
|
||||
./share/postgresql/timezone/Turkey
|
||||
./share/postgresql/timezone/Kwajalein
|
||||
|
|
@ -758,6 +760,7 @@
|
|||
./lib/postgresql/pg_upgrade_support.so
|
||||
./lib/postgresql/java/pljava.jar
|
||||
./lib/postgresql/postgres_fdw.so
|
||||
./lib/postgresql/dblink.so
|
||||
./lib/postgresql/pgoutput.so
|
||||
./lib/libpljava.so
|
||||
./lib/libpq.a
|
||||
|
|
@ -829,6 +832,7 @@
|
|||
./lib/libpagecompression.so*
|
||||
./lib/libdssapi.so
|
||||
./lib/libdms.so
|
||||
./lib/libodbc.so*
|
||||
|
||||
./include/postgresql/server/postgres_ext.h
|
||||
./include/postgresql/server/pg_config_os.h
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ ENDMACRO(CHECK_CC_ENABLE)
|
|||
|
||||
function(GET_VERSIONSTR_FROMGIT ret)
|
||||
set(PG_VERSION "9.2.4")
|
||||
set(OPENGAUSS_VERSION "3.1.0")
|
||||
set(OPENGAUSS_VERSION "5.0.0")
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_SOURCE_DIR}/${openGauss}/cmake/src/buildfunction.sh --s ${PROJECT_TRUNK_DIR} OUTPUT_VARIABLE GS_VERSION_STR)
|
||||
set(PG_VERSION "${PG_VERSION}" PARENT_SCOPE)
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ option(USE_BONJOUR "enable bonjour, the old is --with-bonjour" OFF)
|
|||
option(USE_LDAP "build with ldap, the old is --with-ldap" OFF)#ON
|
||||
option(USE_ETCD "build with etcd libs, new option for old mppdb, after 8.1 close it" OFF)
|
||||
option(USE_PROTOBUF "build with with protobuf's libs, we must need it" ON)
|
||||
option(USE_LIBXML "build with libxml, the old is --with-libxml" OFF)
|
||||
option(USE_LIBXML "build with libxml, the old is --with-libxml" ON)
|
||||
option(HAVE_LIBXML2 "build with libxml2, the old is --with-libxml2" OFF)
|
||||
option(USE_LIBXSLT "build with libxslt, the old is --with-libxslt" OFF)
|
||||
option(USE_PAM "build with pam, the old is --with-pam" OFF)
|
||||
|
|
@ -94,6 +94,7 @@ option(HAVE_LIBM "enable -lm, this set to default -lm" ON)
|
|||
option(HAVE_POSIX_SIGNALS "enable posix signals, this set to default" ON)
|
||||
option(HAVE_GCC_INT_ATOMICS "enable gcc buildin atomics operations, this set to default" ON)
|
||||
option(FLEXIBLE_ARRAY_MEMBER "pq_ce need" ON)
|
||||
option(ENABLE_OPENEULER_MAJOR "support openEuler 22.03 LTS, this set to default" OFF)
|
||||
|
||||
# we will differ compile flags and definitions by different vars
|
||||
set(DB_COMMON_DEFINE "")
|
||||
|
|
@ -139,23 +140,28 @@ if(${ENABLE_LITE_MODE} STREQUAL "ON")
|
|||
set(ENABLE_LLVM_COMPILE OFF)
|
||||
set(ENABLE_GSS OFF)
|
||||
set(KRB5 OFF)
|
||||
set(USE_LIBXML OFF)
|
||||
endif()
|
||||
|
||||
if(${ENABLE_OPENEULER_MAJOR} STREQUAL "ON")
|
||||
add_definitions(-DOPENEULER_MAJOR)
|
||||
endif()
|
||||
|
||||
set(PROTECT_OPTIONS -fwrapv -std=c++14 -fnon-call-exceptions ${OPTIMIZE_LEVEL})
|
||||
set(WARNING_OPTIONS -Wall -Wendif-labels -Werror -Wformat-security)
|
||||
set(WARNING_OPTIONS -Wall -Wendif-labels -Wformat-security)
|
||||
set(OPTIMIZE_OPTIONS -pipe -pthread -fno-aggressive-loop-optimizations -fno-expensive-optimizations -fno-omit-frame-pointer -fno-strict-aliasing -freg-struct-return)
|
||||
set(CHECK_OPTIONS -Wmissing-format-attribute -Wno-attributes -Wno-unused-but-set-variable -Wno-write-strings -Wpointer-arith)
|
||||
set(MACRO_OPTIONS -D_GLIBCXX_USE_CXX11_ABI=0 -DENABLE_GSTRACE -D_GNU_SOURCE -DPGXC -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT -DSTREAMPLAN -D_THREAD_SAFE ${DB_COMMON_DEFINE})
|
||||
|
||||
# Set MAX_ALLOC_SEGNUM size in extreme_rto
|
||||
if(${WAL_SEGSIZE} LESS 512)
|
||||
if(${WAL_SEGSIZE} LESS 256)
|
||||
set(MAX_ALLOC_SEGNUM 4)
|
||||
elseif(${WAL_SEGSIZE} GREATER_EQUAL 512 AND ${WAL_SEGSIZE} LESS 1024)
|
||||
elseif(${WAL_SEGSIZE} GREATER_EQUAL 256 AND ${WAL_SEGSIZE} LESS 512)
|
||||
set(MAX_ALLOC_SEGNUM 2)
|
||||
elseif(${WAL_SEGSIZE} GREATER_EQUAL 1024)
|
||||
elseif(${WAL_SEGSIZE} GREATER_EQUAL 512)
|
||||
set(MAX_ALLOC_SEGNUM 1)
|
||||
else()
|
||||
message(FATAL_ERROR "error: Invalid WAL segment size. Allowed values are 1,2,4,8,16,32,64,128,256,512,1024.")
|
||||
message(FATAL_ERROR "error: Invalid WAL segment size. Allowed values are 1,2,4,8,16,32,64,128,256,512.")
|
||||
endif()
|
||||
|
||||
# libraries need secure options during compling
|
||||
|
|
@ -225,6 +231,7 @@ if(${USE_LIBXML})
|
|||
else()
|
||||
set(LIBS "${LIBS} -lxml")
|
||||
set(GAUSSDB_CONFIGURE "${GAUSSDB_CONFIGURE} -DUSE_LIBXML")
|
||||
set(CMAKE_CXX_FLAGS -l:liblzma.so.5)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
|
|
|||
|
|
@ -116,6 +116,9 @@ function get_gs_version()
|
|||
debug_str="$DEBUG_TYPE"
|
||||
product=$(cat build/script/gaussdb.ver | grep 'PRODUCT' | awk -F "=" '{print $2}')
|
||||
version=$(cat build/script/gaussdb.ver | grep 'VERSION' | awk -F "=" '{print $2}')
|
||||
if [ "${ENABLE_LITE_MODE}" == "ON" ]; then
|
||||
product="$product-lite"
|
||||
fi
|
||||
if test "$enable_ccache" = yes; then
|
||||
default_gs_version="(${product} ${version} build 1f1f1f1f) compiled at 2100-00-00 00:00:00 commit 9999 last mr 9999 debug"
|
||||
else
|
||||
|
|
|
|||
|
|
@ -714,7 +714,7 @@
|
|||
#define PGXC_VERSION_NUM
|
||||
|
||||
/* openGauss version as a number string */
|
||||
#define OPENGAUSS_VERSION_NUM_STR "3.1.0"
|
||||
#define OPENGAUSS_VERSION_NUM_STR "5.0.0"
|
||||
|
||||
/* A string containing the version number, platform, and C compiler */
|
||||
#define PG_VERSION_STR "@PG_VERSION_STR@"
|
||||
|
|
|
|||
|
|
@ -695,7 +695,7 @@
|
|||
#define PG_VERSION "9.2.4"
|
||||
|
||||
/* openGauss version as a string */
|
||||
#define OPENGAUSS_VERSION "3.1.0"
|
||||
#define OPENGAUSS_VERSION "5.0.0"
|
||||
|
||||
/* Gaussdb version as a string*/
|
||||
#define DEF_GS_VERSION "(GaussDB A 8.0.0 build 21f07aff) compiled at 2020-03-17 10:59:07 commit 7431 last mr 12039 debug"
|
||||
|
|
|
|||
|
|
@ -121,6 +121,34 @@ fi])# PGAC_C_FUNCNAME_SUPPORT
|
|||
|
||||
|
||||
|
||||
# PGAC_CHECK_BUILTIN_FUNC
|
||||
# -----------------------
|
||||
# This is similar to AC_CHECK_FUNCS(), except that it will work for compiler
|
||||
# builtin functions, as that usually fails to.
|
||||
# The first argument is the function name, eg [__builtin_clzl], and the
|
||||
# second is its argument list, eg [unsigned long x]. The current coding
|
||||
# works only for a single argument named x; we might generalize that later.
|
||||
# It's assumed that the function's result type is coercible to int.
|
||||
# On success, we define "HAVEfuncname" (there's usually more than enough
|
||||
# underscores already, so we don't add another one).
|
||||
AC_DEFUN([PGAC_CHECK_BUILTIN_FUNC],
|
||||
[AC_CACHE_CHECK(for $1, pgac_cv$1,
|
||||
[AC_LINK_IFELSE([AC_LANG_PROGRAM([
|
||||
int
|
||||
call$1($2)
|
||||
{
|
||||
return $1(x);
|
||||
}], [])],
|
||||
[pgac_cv$1=yes],
|
||||
[pgac_cv$1=no])])
|
||||
if test x"${pgac_cv$1}" = xyes ; then
|
||||
AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE$1]), 1,
|
||||
[Define to 1 if your compiler understands $1.])
|
||||
fi])# PGAC_CHECK_BUILTIN_FUNC
|
||||
|
||||
|
||||
|
||||
|
||||
# PGAC_PROG_CC_CFLAGS_OPT
|
||||
# -----------------------
|
||||
# Given a string, check if the compiler supports the string as a
|
||||
|
|
|
|||
|
|
@ -709,6 +709,7 @@ with_selinux
|
|||
krb_srvtab
|
||||
with_python
|
||||
with_openeuler_os
|
||||
with_openeuler_major
|
||||
enable_thread_safety
|
||||
INCLUDES
|
||||
TAS
|
||||
|
|
@ -828,6 +829,7 @@ enable_nls
|
|||
with_pgport
|
||||
with_gs_version
|
||||
with_openeuler_os
|
||||
with_openeuler_major
|
||||
enable_shared
|
||||
enable_rpath
|
||||
enable_jemalloc
|
||||
|
|
@ -2195,7 +2197,7 @@ PACKAGE_VERSION='9.2.4'
|
|||
# Postgres-XC 1.1devel is based on PostgreSQL 9.2.4
|
||||
PACKAGE_XC_VERSION='1.1'
|
||||
# openGauss is based on PostgreSQL 9.2.4 and it will be the Kernel of GaussDB database
|
||||
OPENGAUSS_VERSION='3.1.0'
|
||||
OPENGAUSS_VERSION='5.0.0'
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define PG_VERSION "$PACKAGE_VERSION"
|
||||
|
|
@ -3272,6 +3274,9 @@ _ACEOF
|
|||
|
||||
fi
|
||||
|
||||
if [ "$(cat /etc/system-release)" == "openEuler release 22.03 LTS" ]; then
|
||||
with_openeuler_major=yes
|
||||
fi
|
||||
|
||||
#
|
||||
# --enable-coverage enables generation of code coverage metrics with gcov
|
||||
|
|
@ -3713,9 +3718,8 @@ case ${wal_segsize} in
|
|||
128) ;;
|
||||
256) ;;
|
||||
512) ;;
|
||||
1024) ;;
|
||||
*) { { $as_echo "$as_me:$LINENO: error: Invalid WAL segment size. Allowed values are 1,2,4,8,16,32,64,128,256,512,1024." >&5
|
||||
$as_echo "$as_me: error: Invalid WAL segment size. Allowed values are 1,2,4,8,16,32,64,128,256,512,1024." >&2;}
|
||||
*) { { $as_echo "$as_me:$LINENO: error: Invalid WAL segment size. Allowed values are 1,2,4,8,16,32,64,128,256,512." >&5
|
||||
$as_echo "$as_me: error: Invalid WAL segment size. Allowed values are 1,2,4,8,16,32,64,128,256,512." >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
esac
|
||||
{ $as_echo "$as_me:$LINENO: result: ${wal_segsize}MB" >&5
|
||||
|
|
@ -3727,9 +3731,9 @@ cat >>confdefs.h <<_ACEOF
|
|||
_ACEOF
|
||||
|
||||
# Set number of MAX_ALLOC_SEGNUM in extreme_rto
|
||||
if test "${wal_segsize}" -lt 512; then
|
||||
if test "${wal_segsize}" -lt 256; then
|
||||
MAX_ALLOC_SEGNUM=4
|
||||
elif test "${wal_segsize}" -ge 512 -a "${wal_segsize}" -lt 1024; then
|
||||
elif test "${wal_segsize}" -ge 256 -a "${wal_segsize}" -lt 512; then
|
||||
MAX_ALLOC_SEGNUM=2
|
||||
else
|
||||
MAX_ALLOC_SEGNUM=1
|
||||
|
|
@ -6477,7 +6481,11 @@ fi
|
|||
# XML
|
||||
#
|
||||
|
||||
|
||||
if [[ "$enable_lite_mode" != yes ]]; then
|
||||
with_libxml=yes
|
||||
else
|
||||
with_libxml=no
|
||||
fi
|
||||
|
||||
# Check whether --with-libxml was given.
|
||||
if test "${with_libxml+set}" = set; then
|
||||
|
|
@ -6505,10 +6513,11 @@ else
|
|||
|
||||
fi
|
||||
|
||||
|
||||
|
||||
xml2_cflag=${with_3rdpartydir}/kernel/dependency/libxml2/comm/include/libxml2
|
||||
xml2_lib=${with_3rdpartydir}/kernel/dependency/libxml2/comm/lib
|
||||
xml2_config=${with_3rdpartydir}/kernel/dependency/libxml2/comm/bin/xml2-config
|
||||
if test "$with_libxml" = yes ; then
|
||||
for ac_prog in xml2-config
|
||||
for ac_prog in ${xml2_config}
|
||||
do
|
||||
# Extract the first word of "$ac_prog", so it can be a program name with args.
|
||||
set dummy $ac_prog; ac_word=$2
|
||||
|
|
@ -6537,7 +6546,7 @@ IFS=$as_save_IFS
|
|||
|
||||
fi
|
||||
fi
|
||||
XML2_CONFIG=$ac_cv_prog_XML2_CONFIG
|
||||
XML2_CONFIG=$xml2_config
|
||||
if test -n "$XML2_CONFIG"; then
|
||||
{ $as_echo "$as_me:$LINENO: result: $XML2_CONFIG" >&5
|
||||
$as_echo "$XML2_CONFIG" >&6; }
|
||||
|
|
@ -6553,12 +6562,12 @@ done
|
|||
if test -n "$XML2_CONFIG"; then
|
||||
for pgac_option in `$XML2_CONFIG --cflags`; do
|
||||
case $pgac_option in
|
||||
-I*|-D*) CPPFLAGS="$CPPFLAGS $pgac_option";;
|
||||
-I*|-D*) CPPFLAGS="$CPPFLAGS $pgac_option -I${xml2_cflag}";;
|
||||
esac
|
||||
done
|
||||
for pgac_option in `$XML2_CONFIG --libs`; do
|
||||
case $pgac_option in
|
||||
-L*) LDFLAGS="$LDFLAGS $pgac_option";;
|
||||
-L*) LDFLAGS="$LDFLAGS $pgac_option -L${xml2_lib}";;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
|
@ -9842,7 +9851,7 @@ if test "${ac_cv_lib_xml2_xmlSaveToBuffer+set}" = set; then
|
|||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-lxml2 $LIBS"
|
||||
LIBS="-L${xml2_lib} -lxml2 -lm -ldl $LIBS"
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
|
|
@ -13434,6 +13443,7 @@ done
|
|||
fi
|
||||
|
||||
if test "$with_libxml" = yes ; then
|
||||
CPPFLAGS="-I${xml2_cflag} $CPPFLAGS"
|
||||
if test "${ac_cv_header_libxml_parser_h+set}" = set; then
|
||||
{ $as_echo "$as_me:$LINENO: checking for libxml/parser.h" >&5
|
||||
$as_echo_n "checking for libxml/parser.h... " >&6; }
|
||||
|
|
@ -18216,9 +18226,47 @@ fi
|
|||
|
||||
# On PPC, check if assembler supports LWARX instruction's mutex hint bit
|
||||
case $host_cpu in
|
||||
x86_64)
|
||||
# On x86_64, check if we can compile a popcntq instruction
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether assembler supports x86_64 popcntq" >&5
|
||||
$as_echo_n "checking whether assembler supports x86_64 popcntq... " >&6; }
|
||||
if ${pgac_cv_have_x86_64_popcntq+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
long long x = 1; long long r;
|
||||
__asm__ __volatile__ (" popcntq %1,%0\n" : "=q"(r) : "rm"(x));
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
pgac_cv_have_x86_64_popcntq=yes
|
||||
else
|
||||
pgac_cv_have_x86_64_popcntq=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_have_x86_64_popcntq" >&5
|
||||
$as_echo "$pgac_cv_have_x86_64_popcntq" >&6; }
|
||||
if test x"$pgac_cv_have_x86_64_popcntq" = xyes ; then
|
||||
|
||||
$as_echo "#define HAVE_X86_64_POPCNTQ 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
;;
|
||||
|
||||
ppc*|powerpc*)
|
||||
{ $as_echo "$as_me:$LINENO: checking whether assembler supports lwarx hint bit" >&5
|
||||
$as_echo_n "checking whether assembler supports lwarx hint bit... " >&6; }
|
||||
if ${pgac_cv_have_ppc_mutex_hint+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
|
|
@ -18262,6 +18310,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
|
|||
fi
|
||||
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
{ $as_echo "$as_me:$LINENO: result: $pgac_cv_have_ppc_mutex_hint" >&5
|
||||
$as_echo "$pgac_cv_have_ppc_mutex_hint" >&6; }
|
||||
if test x"$pgac_cv_have_ppc_mutex_hint" = xyes ; then
|
||||
|
|
@ -24841,6 +24890,237 @@ cat >>confdefs.h <<_ACEOF
|
|||
#define SIZEOF_VOID_P $ac_cv_sizeof_void_p
|
||||
_ACEOF
|
||||
|
||||
# These typically are compiler builtins, for which AC_CHECK_FUNCS fails.
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_bswap16" >&5
|
||||
$as_echo_n "checking for __builtin_bswap16... " >&6; }
|
||||
if ${pgac_cv__builtin_bswap16+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
int
|
||||
call__builtin_bswap16(int x)
|
||||
{
|
||||
return __builtin_bswap16(x);
|
||||
}
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"; then :
|
||||
pgac_cv__builtin_bswap16=yes
|
||||
else
|
||||
pgac_cv__builtin_bswap16=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv__builtin_bswap16" >&5
|
||||
$as_echo "$pgac_cv__builtin_bswap16" >&6; }
|
||||
if test x"${pgac_cv__builtin_bswap16}" = xyes ; then
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE__BUILTIN_BSWAP16 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_bswap32" >&5
|
||||
$as_echo_n "checking for __builtin_bswap32... " >&6; }
|
||||
if ${pgac_cv__builtin_bswap32+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
int
|
||||
call__builtin_bswap32(int x)
|
||||
{
|
||||
return __builtin_bswap32(x);
|
||||
}
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"; then :
|
||||
pgac_cv__builtin_bswap32=yes
|
||||
else
|
||||
pgac_cv__builtin_bswap32=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv__builtin_bswap32" >&5
|
||||
$as_echo "$pgac_cv__builtin_bswap32" >&6; }
|
||||
if test x"${pgac_cv__builtin_bswap32}" = xyes ; then
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE__BUILTIN_BSWAP32 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_bswap64" >&5
|
||||
$as_echo_n "checking for __builtin_bswap64... " >&6; }
|
||||
if ${pgac_cv__builtin_bswap64+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
int
|
||||
call__builtin_bswap64(long int x)
|
||||
{
|
||||
return __builtin_bswap64(x);
|
||||
}
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"; then :
|
||||
pgac_cv__builtin_bswap64=yes
|
||||
else
|
||||
pgac_cv__builtin_bswap64=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv__builtin_bswap64" >&5
|
||||
$as_echo "$pgac_cv__builtin_bswap64" >&6; }
|
||||
if test x"${pgac_cv__builtin_bswap64}" = xyes ; then
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE__BUILTIN_BSWAP64 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
# We assume that we needn't test all widths of these explicitly:
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_clz" >&5
|
||||
$as_echo_n "checking for __builtin_clz... " >&6; }
|
||||
if ${pgac_cv__builtin_clz+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
int
|
||||
call__builtin_clz(unsigned int x)
|
||||
{
|
||||
return __builtin_clz(x);
|
||||
}
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"; then :
|
||||
pgac_cv__builtin_clz=yes
|
||||
else
|
||||
pgac_cv__builtin_clz=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv__builtin_clz" >&5
|
||||
$as_echo "$pgac_cv__builtin_clz" >&6; }
|
||||
if test x"${pgac_cv__builtin_clz}" = xyes ; then
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE__BUILTIN_CLZ 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_ctz" >&5
|
||||
$as_echo_n "checking for __builtin_ctz... " >&6; }
|
||||
if ${pgac_cv__builtin_ctz+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
int
|
||||
call__builtin_ctz(unsigned int x)
|
||||
{
|
||||
return __builtin_ctz(x);
|
||||
}
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"; then :
|
||||
pgac_cv__builtin_ctz=yes
|
||||
else
|
||||
pgac_cv__builtin_ctz=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv__builtin_ctz" >&5
|
||||
$as_echo "$pgac_cv__builtin_ctz" >&6; }
|
||||
if test x"${pgac_cv__builtin_ctz}" = xyes ; then
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE__BUILTIN_CTZ 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_popcount" >&5
|
||||
$as_echo_n "checking for __builtin_popcount... " >&6; }
|
||||
if ${pgac_cv__builtin_popcount+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
int
|
||||
call__builtin_popcount(unsigned int x)
|
||||
{
|
||||
return __builtin_popcount(x);
|
||||
}
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"; then :
|
||||
pgac_cv__builtin_popcount=yes
|
||||
else
|
||||
pgac_cv__builtin_popcount=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv__builtin_popcount" >&5
|
||||
$as_echo "$pgac_cv__builtin_popcount" >&6; }
|
||||
if test x"${pgac_cv__builtin_popcount}" = xyes ; then
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE__BUILTIN_POPCOUNT 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
|
||||
|
||||
# The cast to long int works around a bug in the HP C Compiler
|
||||
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
|
||||
|
|
|
|||
23
configure.in
23
configure.in
|
|
@ -384,8 +384,7 @@ case ${wal_segsize} in
|
|||
128) ;;
|
||||
256) ;;
|
||||
512) ;;
|
||||
1024) ;;
|
||||
*) AC_MSG_ERROR([Invalid WAL segment size. Allowed values are 1,2,4,8,16,32,64,128,256,512,1024.])
|
||||
*) AC_MSG_ERROR([Invalid WAL segment size. Allowed values are 1,2,4,8,16,32,64,128,256,512.])
|
||||
esac
|
||||
AC_MSG_RESULT([${wal_segsize}MB])
|
||||
|
||||
|
|
@ -398,9 +397,9 @@ AC_DEFINE_UNQUOTED([XLOG_SEG_SIZE], [(${wal_segsize} * 1024 * 1024)], [
|
|||
])
|
||||
|
||||
# Set number of MAX_ALLOC_SEGNUM in extreme_rto
|
||||
if test "${wal_segsize}" -lt 512; then
|
||||
if test "${wal_segsize}" -lt 256; then
|
||||
MAX_ALLOC_SEGNUM=4
|
||||
elif test "${wal_segsize}" -ge 512 -a "${wal_segsize}" -lt 1024; then
|
||||
elif test "${wal_segsize}" -ge 256 -a "${wal_segsize}" -lt 512; then
|
||||
MAX_ALLOC_SEGNUM=2
|
||||
else
|
||||
MAX_ALLOC_SEGNUM=1
|
||||
|
|
@ -1187,6 +1186,19 @@ fi
|
|||
|
||||
# On PPC, check if assembler supports LWARX instruction's mutex hint bit
|
||||
case $host_cpu in
|
||||
x86_64)
|
||||
# On x86_64, check if we can compile a popcntq instruction
|
||||
AC_CACHE_CHECK([whether assembler supports x86_64 popcntq],
|
||||
[pgac_cv_have_x86_64_popcntq],
|
||||
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
|
||||
[long long x = 1; long long r;
|
||||
__asm__ __volatile__ (" popcntq %1,%0\n" : "=q"(r) : "rm"(x));])],
|
||||
[pgac_cv_have_x86_64_popcntq=yes],
|
||||
[pgac_cv_have_x86_64_popcntq=no])])
|
||||
if test x"$pgac_cv_have_x86_64_popcntq" = xyes ; then
|
||||
AC_DEFINE(HAVE_X86_64_POPCNTQ, 1, [Define to 1 if the assembler supports X86_64's POPCNTQ instruction.])
|
||||
fi
|
||||
;;
|
||||
ppc*|powerpc*)
|
||||
AC_MSG_CHECKING([whether assembler supports lwarx hint bit])
|
||||
AC_TRY_COMPILE([],
|
||||
|
|
@ -1235,6 +1247,9 @@ LIBS=`echo "$LIBS" | sed -e 's/-ledit//g' -e 's/-lreadline//g'`
|
|||
|
||||
AC_CHECK_FUNCS([cbrt dlopen fdatasync getifaddrs getpeerucred getrlimit mbstowcs_l memmove poll pstat readlink setproctitle setsid sigprocmask symlink sync_file_range towlower utime utimes waitpid wcstombs wcstombs_l])
|
||||
|
||||
# We assume that we needn't test all widths of these explicitly:
|
||||
PGAC_CHECK_BUILTIN_FUNC([__builtin_clz], [unsigned int x])
|
||||
|
||||
AC_REPLACE_FUNCS(fseeko)
|
||||
case $host_os in
|
||||
# NetBSD uses a custom fseeko/ftello built on fsetpos/fgetpos
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
MODULE_big = dblink
|
||||
OBJS = dblink.o
|
||||
PG_CPPFLAGS = -I$(libpq_srcdir)
|
||||
SHLIB_LINK = $(libpq)
|
||||
SHLIB_LINK = $(libpq) -L$(LIBODBC_LIB_PATH) -lodbc
|
||||
SHLIB_PREREQS = submake-libpq
|
||||
|
||||
EXTENSION = dblink
|
||||
|
|
|
|||
|
|
@ -221,3 +221,8 @@ CREATE FUNCTION dblink_get_notify(
|
|||
RETURNS setof record
|
||||
AS 'MODULE_PATHNAME', 'dblink_get_notify'
|
||||
LANGUAGE C STRICT;
|
||||
|
||||
CREATE FUNCTION dblink_get_drivername()
|
||||
RETURNS text
|
||||
AS 'MODULE_PATHNAME', 'dblink_get_drivername'
|
||||
LANGUAGE C STRICT;
|
||||
|
|
@ -44,3 +44,4 @@ ALTER EXTENSION dblink ADD function dblink_cancel_query(text);
|
|||
ALTER EXTENSION dblink ADD function dblink_error_message(text);
|
||||
ALTER EXTENSION dblink ADD function dblink_get_notify();
|
||||
ALTER EXTENSION dblink ADD function dblink_get_notify(text);
|
||||
ALTER EXTENSION dblink ADD function dblink_get_drivername();
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -35,6 +35,113 @@
|
|||
#define DBLINK_H
|
||||
|
||||
#include "fmgr.h"
|
||||
#include "sql.h"
|
||||
#include "sqlext.h"
|
||||
|
||||
|
||||
typedef struct ODBCconn {
|
||||
SQLHENV envHandle; /* Handle ODBC environment */
|
||||
SQLHDBC connHandle; /* Handle connection */
|
||||
SQLHSTMT stmt; /* Handle sql */
|
||||
} ODBCconn;
|
||||
|
||||
typedef struct storeInfo {
|
||||
FunctionCallInfo fcinfo;
|
||||
Tuplestorestate* tuplestore;
|
||||
AttInMetadata* attinmeta;
|
||||
MemoryContext tmpcontext;
|
||||
char** cstrs;
|
||||
/* temp storage for results to avoid leaks on exception */
|
||||
PGresult* last_res;
|
||||
PGresult* cur_res;
|
||||
} storeInfo;
|
||||
|
||||
typedef struct LinkInfo {
|
||||
SQLCHAR* username; /* odbc username */
|
||||
SQLCHAR* password; /* odbc password */
|
||||
SQLCHAR* drivername; /* odbc driver name */
|
||||
} LinkInfo;
|
||||
|
||||
class Linker : public BaseObject {
|
||||
public:
|
||||
virtual void finish() = 0;
|
||||
virtual text* exec(char* conname, const char* sql, bool fail) = 0;
|
||||
virtual char* errorMsg() = 0;
|
||||
virtual int isBusy() = 0;
|
||||
virtual char* cancel(PGcancel* cancel) = 0;
|
||||
virtual int sendQuery(char* sql) = 0;
|
||||
virtual char* open(char* conname, char* sql, bool fail) = 0;
|
||||
virtual char* close(char* conname, char* sql, bool fail) = 0;
|
||||
virtual void getResult(char* conname, FunctionCallInfo fcinfo, char* sql, bool fail) = 0;
|
||||
virtual void queryResult(ReturnSetInfo* rsinfo, const char* conname, storeInfo* sinfo, const char* sql, bool fail) = 0;
|
||||
virtual void fetch(char* conname, FunctionCallInfo fcinfo, const char* sql, bool fail, char* curname) = 0;
|
||||
virtual void getNotify(ReturnSetInfo* rsinfo) = 0;
|
||||
};
|
||||
|
||||
typedef struct remoteConn {
|
||||
Linker* linker;
|
||||
} remoteConn;
|
||||
|
||||
typedef struct dblink_session_context {
|
||||
remoteConn* pconn;
|
||||
HTAB* remoteConnHash;
|
||||
} dblink_session_context;
|
||||
|
||||
/*
|
||||
* Following is list that holds multiple remote connections.
|
||||
* Calling convention of each dblink function changes to accept
|
||||
* connection name as the first parameter. The connection list is
|
||||
* much like ecpg e.g. a mapping between a name and a PGconn object.
|
||||
*/
|
||||
|
||||
typedef struct remoteConnHashEnt {
|
||||
char name[NAMEDATALEN];
|
||||
remoteConn* rconn;
|
||||
} remoteConnHashEnt;
|
||||
|
||||
class PQLinker : public Linker {
|
||||
public:
|
||||
PGconn* conn;
|
||||
PGresult* res;
|
||||
int openCursorCount; /* The number of open cursors */
|
||||
bool newXactForCursor; /* Opened a transaction for a cursor */
|
||||
public:
|
||||
PQLinker(char* connstr);
|
||||
void finish();
|
||||
text* exec(char* conname, const char* sql, bool fail);
|
||||
char* errorMsg();
|
||||
int isBusy();
|
||||
char* cancel(PGcancel* cancel);
|
||||
int sendQuery(char* sql);
|
||||
char* open(char* conname, char* sql, bool fail);
|
||||
char* close(char* conname, char* sql, bool fail);
|
||||
void getResult(char* conname, FunctionCallInfo fcinfo, char* sql, bool fail);
|
||||
void queryResult(ReturnSetInfo* rsinfo, const char* conname, storeInfo* sinfo, const char* sql, bool fail);
|
||||
void fetch(char* conname, FunctionCallInfo fcinfo, const char* sql, bool fail, char* curname);
|
||||
void getNotify(ReturnSetInfo* rsinfo);
|
||||
};
|
||||
|
||||
|
||||
class ODBCLinker : public Linker {
|
||||
public:
|
||||
SQLHENV envHandle; /* Handle ODBC environment */
|
||||
SQLHDBC connHandle; /* Handle connection */
|
||||
SQLHSTMT stmt; /* Handle sql */
|
||||
public:
|
||||
ODBCLinker(char* connstr_or_name);
|
||||
void finish();
|
||||
text* exec(char* conname, const char* sql, bool fail);
|
||||
char* errorMsg();
|
||||
int isBusy();
|
||||
char* cancel(PGcancel* cancel);
|
||||
int sendQuery(char* sql);
|
||||
char* open(char* conname, char* sql, bool fail);
|
||||
char* close(char* conname, char* sql, bool fail);
|
||||
void getResult(char* conname, FunctionCallInfo fcinfo, char* sql, bool fail);
|
||||
void queryResult(ReturnSetInfo* rsinfo, const char* conname, storeInfo* sinfo, const char* sql, bool fail);
|
||||
void fetch(char* conname, FunctionCallInfo fcinfo, const char* sql, bool fail, char* curname);
|
||||
void getNotify(ReturnSetInfo* rsinfo);
|
||||
};
|
||||
|
||||
/*
|
||||
* External declarations
|
||||
|
|
@ -58,6 +165,7 @@ extern "C" Datum dblink_build_sql_delete(PG_FUNCTION_ARGS);
|
|||
extern "C" Datum dblink_build_sql_update(PG_FUNCTION_ARGS);
|
||||
extern "C" Datum dblink_current_query(PG_FUNCTION_ARGS);
|
||||
extern "C" Datum dblink_get_notify(PG_FUNCTION_ARGS);
|
||||
extern "C" Datum dblink_get_drivername(PG_FUNCTION_ARGS);
|
||||
extern "C" void set_extension_index(uint32 index);
|
||||
extern "C" void init_session_vars(void);
|
||||
|
||||
|
|
|
|||
|
|
@ -375,7 +375,7 @@ static List* get_file_fdw_attribute_options(Oid relid)
|
|||
|
||||
/* Retrieve FDW options for all user-defined attributes. */
|
||||
for (attnum = 1; attnum <= natts; attnum++) {
|
||||
Form_pg_attribute attr = tupleDesc->attrs[attnum - 1];
|
||||
Form_pg_attribute attr = &tupleDesc->attrs[attnum - 1];
|
||||
List* options = NIL;
|
||||
ListCell* lc = NULL;
|
||||
|
||||
|
|
@ -712,7 +712,7 @@ static void estimate_size(PlannerInfo* root, RelOptInfo* baserel, FileFdwPlanSta
|
|||
*/
|
||||
int tuple_width;
|
||||
|
||||
tuple_width = MAXALIGN(baserel->width) + MAXALIGN(sizeof(HeapTupleHeaderData));
|
||||
tuple_width = MAXALIGN(baserel->reltarget->width) + MAXALIGN(sizeof(HeapTupleHeaderData));
|
||||
ntuples = clamp_row_est((double)stat_buf.st_size / (double)tuple_width);
|
||||
|
||||
baserel->tuples = ntuples;
|
||||
|
|
|
|||
|
|
@ -745,7 +745,7 @@ List* build_tlist_to_deparse(RelOptInfo* foreignrel)
|
|||
* We require columns specified in foreignrel->reltarget->exprs and those
|
||||
* required for evaluating the local conditions.
|
||||
*/
|
||||
tlist = foreignrel->reltargetlist;
|
||||
tlist = foreignrel->reltarget->exprs;
|
||||
|
||||
foreach (lc, fpinfo->local_conds) {
|
||||
RestrictInfo* rinfo = lfirst_node(RestrictInfo, lc);
|
||||
|
|
@ -929,7 +929,7 @@ static void gcdeparseTargetList(StringInfo buf, PlannerInfo* root, Index rtindex
|
|||
have_wholerow = bms_is_member(0 - FirstLowInvalidHeapAttributeNumber, attrs_used);
|
||||
|
||||
for (i = 1; i <= tupdesc->natts; i++) {
|
||||
Form_pg_attribute attr = tupdesc->attrs[i - 1];
|
||||
Form_pg_attribute attr = &tupdesc->attrs[i - 1];
|
||||
|
||||
/* Ignore dropped attributes. */
|
||||
if (attr->attisdropped)
|
||||
|
|
@ -1122,7 +1122,7 @@ static void gcDeparseSubqueryTargetList(deparse_expr_cxt* context)
|
|||
/* Should only be called in these cases. */
|
||||
Assert(IS_SIMPLE_REL(foreignrel) || IS_JOIN_REL(foreignrel));
|
||||
|
||||
foreach (lc, foreignrel->reltargetlist) {
|
||||
foreach (lc, foreignrel->reltarget->exprs) {
|
||||
Node* node = (Node*)lfirst(lc);
|
||||
|
||||
if (!first)
|
||||
|
|
@ -2213,7 +2213,7 @@ static void get_relation_column_alias_ids(Var* node, RelOptInfo* foreignrel, int
|
|||
|
||||
/* Get the column alias ID */
|
||||
i = 1;
|
||||
foreach (lc, foreignrel->reltargetlist) {
|
||||
foreach (lc, foreignrel->reltarget->exprs) {
|
||||
if (equal(lfirst(lc), (Node*)node)) {
|
||||
*colno = i;
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -348,7 +348,7 @@ static void gcGetForeignRelSize(PlannerInfo* root, RelOptInfo* baserel, Oid fore
|
|||
* columns used in them. Doesn't seem worth detecting that case though.)
|
||||
*/
|
||||
fpinfo->attrs_used = NULL;
|
||||
pull_varattnos((Node*)baserel->reltargetlist, baserel->relid, &fpinfo->attrs_used);
|
||||
pull_varattnos((Node*)baserel->reltarget->exprs, baserel->relid, &fpinfo->attrs_used);
|
||||
foreach (lc, fpinfo->local_conds) {
|
||||
RestrictInfo* rinfo = lfirst_node(RestrictInfo, lc);
|
||||
|
||||
|
|
@ -390,7 +390,7 @@ static void gcGetForeignRelSize(PlannerInfo* root, RelOptInfo* baserel, Oid fore
|
|||
baserel->pages = 10;
|
||||
const int BLOCK_NUM = 10;
|
||||
baserel->tuples =
|
||||
(double)(BLOCK_NUM * BLCKSZ) / (baserel->width + MAXALIGN(offsetof(HeapTupleHeaderData, t_bits)));
|
||||
(double)(BLOCK_NUM * BLCKSZ) / (baserel->reltarget->width + MAXALIGN(offsetof(HeapTupleHeaderData, t_bits)));
|
||||
}
|
||||
|
||||
/* Estimate baserel size as best we can with local statistics. */
|
||||
|
|
@ -702,7 +702,7 @@ static void gcBeginForeignScan(ForeignScanState* node, int eflags)
|
|||
|
||||
for (int i = 0; i < list_length(fsstate->retrieved_attrs); i++) {
|
||||
int attidx = list_nth_int(fsstate->retrieved_attrs, i);
|
||||
Form_pg_attribute attr = slot->tts_tupleDescriptor->attrs[attidx - 1];
|
||||
Form_pg_attribute attr = &slot->tts_tupleDescriptor->attrs[attidx - 1];
|
||||
const char* attname = (const char*)(attr->attname.data);
|
||||
TupleDescInitEntry(scan_desc, i + 1, attname, attr->atttypid, attr->atttypmod, 0);
|
||||
}
|
||||
|
|
@ -747,8 +747,8 @@ static void gcBeginForeignScan(ForeignScanState* node, int eflags)
|
|||
fsstate->resultSlot->tts_isnull[i] = true;
|
||||
}
|
||||
|
||||
fsstate->resultSlot->tts_isempty = false;
|
||||
fsstate->scanSlot->tts_isempty = false;
|
||||
fsstate->resultSlot->tts_flags &= ~TTS_FLAG_EMPTY;
|
||||
fsstate->scanSlot->tts_flags &= ~TTS_FLAG_EMPTY;
|
||||
|
||||
fsstate->attinmeta = TupleDescGetAttInMetadata(fsstate->tupdesc);
|
||||
|
||||
|
|
@ -864,7 +864,7 @@ static void postgresConstructResultSlotWithArray(ForeignScanState* node)
|
|||
for (scanAttr = 0, resultAttr = 0; resultAttr < resultDesc->natts; resultAttr++, scanAttr += map) {
|
||||
Assert(list_length(colmap) == resultDesc->natts);
|
||||
|
||||
Oid typoid = resultDesc->attrs[resultAttr]->atttypid;
|
||||
Oid typoid = resultDesc->attrs[resultAttr].atttypid;
|
||||
Value* val = (Value*)list_nth(colmap, resultAttr);
|
||||
map = val->val.ival;
|
||||
|
||||
|
|
@ -919,7 +919,7 @@ static void postgresConstructResultSlotWithArray(ForeignScanState* node)
|
|||
}
|
||||
|
||||
resultSlot->tts_nvalid = resultDesc->natts;
|
||||
resultSlot->tts_isempty = false;
|
||||
resultSlot->tts_flags &= ~TTS_FLAG_EMPTY;
|
||||
}
|
||||
|
||||
static void postgresMapResultFromScanSlot(ForeignScanState* node)
|
||||
|
|
@ -958,7 +958,7 @@ static TupleTableSlot* gcIterateNormalForeignScan(ForeignScanState* node)
|
|||
|
||||
/* reset tupleslot on the begin */
|
||||
(void)ExecClearTuple(fsstate->resultSlot);
|
||||
fsstate->resultSlot->tts_isempty = false;
|
||||
fsstate->resultSlot->tts_flags &= ~TTS_FLAG_EMPTY;
|
||||
|
||||
TupleTableSlot* slot = node->ss.ss_ScanTupleSlot;
|
||||
|
||||
|
|
@ -1469,7 +1469,7 @@ static void gc_estimate_path_cost_size(PlannerInfo* root, RelOptInfo* foreignrel
|
|||
* between foreign relations.
|
||||
*/
|
||||
rows = foreignrel->rows;
|
||||
width = foreignrel->width;
|
||||
width = foreignrel->reltarget->width;
|
||||
|
||||
/* Back into an estimate of the number of retrieved rows. */
|
||||
retrieved_rows = clamp_row_est(rows / fpinfo->local_conds_sel);
|
||||
|
|
@ -1813,17 +1813,17 @@ static void gcfdw_fetch_remote_table_info(
|
|||
pq_sendint(&retbuf, tupdesc->natts, 4);
|
||||
|
||||
for (int i = 0; i < tupdesc->natts; i++) {
|
||||
att_name_len = strlen(tupdesc->attrs[i]->attname.data);
|
||||
att_name_len = strlen(tupdesc->attrs[i].attname.data);
|
||||
pq_sendint(&retbuf, att_name_len, 4);
|
||||
pq_sendbytes(&retbuf, tupdesc->attrs[i]->attname.data, att_name_len);
|
||||
pq_sendbytes(&retbuf, tupdesc->attrs[i].attname.data, att_name_len);
|
||||
|
||||
Assert(InvalidOid != tupdesc->attrs[i]->atttypid);
|
||||
Assert(InvalidOid != tupdesc->attrs[i].atttypid);
|
||||
|
||||
type_name = get_typename(tupdesc->attrs[i]->atttypid);
|
||||
type_name = get_typename(tupdesc->attrs[i].atttypid);
|
||||
type_name_len = strlen(type_name);
|
||||
pq_sendint(&retbuf, type_name_len, 4);
|
||||
pq_sendbytes(&retbuf, type_name, type_name_len);
|
||||
pq_sendint(&retbuf, tupdesc->attrs[i]->atttypmod, 4);
|
||||
pq_sendint(&retbuf, tupdesc->attrs[i].atttypmod, 4);
|
||||
pfree(type_name);
|
||||
}
|
||||
|
||||
|
|
@ -2368,7 +2368,7 @@ static void conversion_error_callback(void *arg)
|
|||
TupleDesc tupdesc = RelationGetDescr(errpos->rel);
|
||||
|
||||
if (errpos->cur_attno > 0 && errpos->cur_attno <= tupdesc->natts) {
|
||||
attname = NameStr(tupdesc->attrs[errpos->cur_attno - 1]->attname);
|
||||
attname = NameStr(tupdesc->attrs[errpos->cur_attno - 1].attname);
|
||||
} else if (errpos->cur_attno == SelfItemPointerAttributeNumber) {
|
||||
attname = "ctid";
|
||||
} else if (errpos->cur_attno == ObjectIdAttributeNumber) {
|
||||
|
|
@ -2588,7 +2588,7 @@ static void GcFdwCopyRemoteInfo(PgFdwRemoteInfo* new_remote_info, PgFdwRemoteInf
|
|||
bool hasSpecialArrayType(TupleDesc desc)
|
||||
{
|
||||
for (int i = 0; i < desc->natts; i++) {
|
||||
Oid typoid = desc->attrs[i]->atttypid;
|
||||
Oid typoid = desc->attrs[i].atttypid;
|
||||
|
||||
if (INT8ARRAYOID == typoid || FLOAT8ARRAYOID == typoid || FLOAT4ARRAYOID == typoid || NUMERICARRAY == typoid) {
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -702,15 +702,15 @@ Datum hstore_from_record(PG_FUNCTION_ARGS)
|
|||
|
||||
for (i = 0, j = 0; i < ncolumns; ++i) {
|
||||
ColumnIOData* column_info = &my_extra->columns[i];
|
||||
Oid column_type = tupdesc->attrs[i]->atttypid;
|
||||
Oid column_type = tupdesc->attrs[i].atttypid;
|
||||
char* value = NULL;
|
||||
|
||||
/* Ignore dropped columns in datatype */
|
||||
if (tupdesc->attrs[i]->attisdropped)
|
||||
if (tupdesc->attrs[i].attisdropped)
|
||||
continue;
|
||||
|
||||
pairs[j].key = NameStr(tupdesc->attrs[i]->attname);
|
||||
pairs[j].keylen = hstoreCheckKeyLen(strlen(NameStr(tupdesc->attrs[i]->attname)));
|
||||
pairs[j].key = NameStr(tupdesc->attrs[i].attname);
|
||||
pairs[j].keylen = hstoreCheckKeyLen(strlen(NameStr(tupdesc->attrs[i].attname)));
|
||||
|
||||
if (nulls == NULL || nulls[i]) {
|
||||
pairs[j].val = NULL;
|
||||
|
|
@ -864,18 +864,18 @@ Datum hstore_populate_record(PG_FUNCTION_ARGS)
|
|||
|
||||
for (i = 0; i < ncolumns; ++i) {
|
||||
ColumnIOData* column_info = &my_extra->columns[i];
|
||||
Oid column_type = tupdesc->attrs[i]->atttypid;
|
||||
Oid column_type = tupdesc->attrs[i].atttypid;
|
||||
char* value = NULL;
|
||||
int idx;
|
||||
int vallen;
|
||||
|
||||
/* Ignore dropped columns in datatype */
|
||||
if (tupdesc->attrs[i]->attisdropped) {
|
||||
if (tupdesc->attrs[i].attisdropped) {
|
||||
nulls[i] = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
idx = hstoreFindKey(hs, 0, NameStr(tupdesc->attrs[i]->attname), strlen(NameStr(tupdesc->attrs[i]->attname)));
|
||||
idx = hstoreFindKey(hs, 0, NameStr(tupdesc->attrs[i].attname), strlen(NameStr(tupdesc->attrs[i].attname)));
|
||||
|
||||
/*
|
||||
* we can't just skip here if the key wasn't found since we might have
|
||||
|
|
@ -903,7 +903,7 @@ Datum hstore_populate_record(PG_FUNCTION_ARGS)
|
|||
* checks are done
|
||||
*/
|
||||
values[i] =
|
||||
InputFunctionCall(&column_info->proc, NULL, column_info->typioparam, tupdesc->attrs[i]->atttypmod);
|
||||
InputFunctionCall(&column_info->proc, NULL, column_info->typioparam, tupdesc->attrs[i].atttypmod);
|
||||
nulls[i] = true;
|
||||
} else {
|
||||
vallen = HS_VALLEN(entries, idx);
|
||||
|
|
@ -913,7 +913,7 @@ Datum hstore_populate_record(PG_FUNCTION_ARGS)
|
|||
value[vallen] = 0;
|
||||
|
||||
values[i] =
|
||||
InputFunctionCall(&column_info->proc, value, column_info->typioparam, tupdesc->attrs[i]->atttypmod);
|
||||
InputFunctionCall(&column_info->proc, value, column_info->typioparam, tupdesc->attrs[i].atttypmod);
|
||||
nulls[i] = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include "access/gist.h"
|
||||
#include "access/skey.h"
|
||||
#include "port/pg_bitutils.h"
|
||||
|
||||
#include "_int.h"
|
||||
|
||||
|
|
@ -29,264 +30,6 @@ extern "C" Datum g_intbig_picksplit(PG_FUNCTION_ARGS);
|
|||
extern "C" Datum g_intbig_union(PG_FUNCTION_ARGS);
|
||||
extern "C" Datum g_intbig_same(PG_FUNCTION_ARGS);
|
||||
|
||||
/* Number of one-bits in an unsigned byte */
|
||||
static const uint8 number_of_ones[256] = {0,
|
||||
1,
|
||||
1,
|
||||
2,
|
||||
1,
|
||||
2,
|
||||
2,
|
||||
3,
|
||||
1,
|
||||
2,
|
||||
2,
|
||||
3,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
1,
|
||||
2,
|
||||
2,
|
||||
3,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
1,
|
||||
2,
|
||||
2,
|
||||
3,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
4,
|
||||
5,
|
||||
5,
|
||||
6,
|
||||
1,
|
||||
2,
|
||||
2,
|
||||
3,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
4,
|
||||
5,
|
||||
5,
|
||||
6,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
4,
|
||||
5,
|
||||
5,
|
||||
6,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
4,
|
||||
5,
|
||||
5,
|
||||
6,
|
||||
4,
|
||||
5,
|
||||
5,
|
||||
6,
|
||||
5,
|
||||
6,
|
||||
6,
|
||||
7,
|
||||
1,
|
||||
2,
|
||||
2,
|
||||
3,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
4,
|
||||
5,
|
||||
5,
|
||||
6,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
4,
|
||||
5,
|
||||
5,
|
||||
6,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
4,
|
||||
5,
|
||||
5,
|
||||
6,
|
||||
4,
|
||||
5,
|
||||
5,
|
||||
6,
|
||||
5,
|
||||
6,
|
||||
6,
|
||||
7,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
4,
|
||||
5,
|
||||
5,
|
||||
6,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
4,
|
||||
5,
|
||||
5,
|
||||
6,
|
||||
4,
|
||||
5,
|
||||
5,
|
||||
6,
|
||||
5,
|
||||
6,
|
||||
6,
|
||||
7,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
4,
|
||||
5,
|
||||
5,
|
||||
6,
|
||||
4,
|
||||
5,
|
||||
5,
|
||||
6,
|
||||
5,
|
||||
6,
|
||||
6,
|
||||
7,
|
||||
4,
|
||||
5,
|
||||
5,
|
||||
6,
|
||||
5,
|
||||
6,
|
||||
6,
|
||||
7,
|
||||
5,
|
||||
6,
|
||||
6,
|
||||
7,
|
||||
6,
|
||||
7,
|
||||
7,
|
||||
8};
|
||||
|
||||
PG_FUNCTION_INFO_V1(_intbig_in);
|
||||
extern "C" Datum _intbig_in(PG_FUNCTION_ARGS);
|
||||
|
||||
|
|
@ -428,11 +171,7 @@ Datum g_intbig_compress(PG_FUNCTION_ARGS)
|
|||
|
||||
static int4 sizebitvec(BITVECP sign)
|
||||
{
|
||||
int4 size = 0, i;
|
||||
|
||||
LOOPBYTE
|
||||
size += number_of_ones[(unsigned char)sign[i]];
|
||||
return size;
|
||||
return pg_popcount(sign, SIGLEN);
|
||||
}
|
||||
|
||||
static int hemdistsign(BITVECP a, BITVECP b)
|
||||
|
|
@ -442,7 +181,8 @@ static int hemdistsign(BITVECP a, BITVECP b)
|
|||
LOOPBYTE
|
||||
{
|
||||
diff = (unsigned char)(a[i] ^ b[i]);
|
||||
dist += number_of_ones[diff];
|
||||
/* Using the popcount functions here isn't likely to win */
|
||||
dist += pg_number_of_ones[diff];
|
||||
}
|
||||
return dist;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1530,7 +1530,7 @@ static void fill_pglog_planstate_from_logft_rel(pglogPlanState* pg_log, Relation
|
|||
|
||||
Assert(PGLOG_ATTR_MAX == tupdesc->natts);
|
||||
for (int i = 0; i < PGLOG_ATTR_MAX; ++i) {
|
||||
Form_pg_attribute att = tupdesc->attrs[i];
|
||||
Form_pg_attribute att = &tupdesc->attrs[i];
|
||||
pg_log->allattr_typmod[i] = att->atttypmod;
|
||||
getTypeInputInfo(att->atttypid, &in_func_oid, &pg_log->allattr_typioparam[i]);
|
||||
fmgr_info(in_func_oid, &pg_log->allattr_fmgrinfo[i]);
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
#include "access/gist.h"
|
||||
#include "access/skey.h"
|
||||
#include "port/pg_bitutils.h"
|
||||
#include "crc32.h"
|
||||
#include "ltree.h"
|
||||
|
||||
|
|
@ -34,264 +35,6 @@ extern "C" Datum _ltree_consistent(PG_FUNCTION_ARGS);
|
|||
#define GETENTRY(vec, pos) ((ltree_gist*)DatumGetPointer((vec)->vector[(pos)].key))
|
||||
#define NEXTVAL(x) ((ltree*)((char*)(x) + INTALIGN(VARSIZE(x))))
|
||||
|
||||
/* Number of one-bits in an unsigned byte */
|
||||
static const uint8 number_of_ones[256] = {0,
|
||||
1,
|
||||
1,
|
||||
2,
|
||||
1,
|
||||
2,
|
||||
2,
|
||||
3,
|
||||
1,
|
||||
2,
|
||||
2,
|
||||
3,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
1,
|
||||
2,
|
||||
2,
|
||||
3,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
1,
|
||||
2,
|
||||
2,
|
||||
3,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
4,
|
||||
5,
|
||||
5,
|
||||
6,
|
||||
1,
|
||||
2,
|
||||
2,
|
||||
3,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
4,
|
||||
5,
|
||||
5,
|
||||
6,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
4,
|
||||
5,
|
||||
5,
|
||||
6,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
4,
|
||||
5,
|
||||
5,
|
||||
6,
|
||||
4,
|
||||
5,
|
||||
5,
|
||||
6,
|
||||
5,
|
||||
6,
|
||||
6,
|
||||
7,
|
||||
1,
|
||||
2,
|
||||
2,
|
||||
3,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
4,
|
||||
5,
|
||||
5,
|
||||
6,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
4,
|
||||
5,
|
||||
5,
|
||||
6,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
4,
|
||||
5,
|
||||
5,
|
||||
6,
|
||||
4,
|
||||
5,
|
||||
5,
|
||||
6,
|
||||
5,
|
||||
6,
|
||||
6,
|
||||
7,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
4,
|
||||
5,
|
||||
5,
|
||||
6,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
4,
|
||||
5,
|
||||
5,
|
||||
6,
|
||||
4,
|
||||
5,
|
||||
5,
|
||||
6,
|
||||
5,
|
||||
6,
|
||||
6,
|
||||
7,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
4,
|
||||
5,
|
||||
5,
|
||||
6,
|
||||
4,
|
||||
5,
|
||||
5,
|
||||
6,
|
||||
5,
|
||||
6,
|
||||
6,
|
||||
7,
|
||||
4,
|
||||
5,
|
||||
5,
|
||||
6,
|
||||
5,
|
||||
6,
|
||||
6,
|
||||
7,
|
||||
5,
|
||||
6,
|
||||
6,
|
||||
7,
|
||||
6,
|
||||
7,
|
||||
7,
|
||||
8};
|
||||
|
||||
#define WISH_F(a, b, c) (double)(-(double)(((a) - (b)) * ((a) - (b)) * ((a) - (b))) * (c))
|
||||
|
||||
static void hashing(BITVECP sign, ltree* t)
|
||||
|
|
@ -431,11 +174,7 @@ Datum _ltree_union(PG_FUNCTION_ARGS)
|
|||
|
||||
static int4 sizebitvec(BITVECP sign)
|
||||
{
|
||||
int4 size = 0, i;
|
||||
|
||||
ALOOPBYTE
|
||||
size += number_of_ones[(unsigned char)sign[i]];
|
||||
return size;
|
||||
return pg_popcount((const char *) sign, ASIGLEN);
|
||||
}
|
||||
|
||||
static int hemdistsign(BITVECP a, BITVECP b)
|
||||
|
|
@ -445,7 +184,8 @@ static int hemdistsign(BITVECP a, BITVECP b)
|
|||
ALOOPBYTE
|
||||
{
|
||||
diff = (unsigned char)(a[i] ^ b[i]);
|
||||
dist += number_of_ones[diff];
|
||||
/* Using the popcount functions here isn't likely to win */
|
||||
dist += pg_number_of_ones[diff];
|
||||
}
|
||||
return dist;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -226,8 +226,8 @@ static bool pg_decode_filter(LogicalDecodingContext* ctx, RepOriginId origin_id)
|
|||
}
|
||||
|
||||
/* print the tuple 'tuple' into the StringInfo s */
|
||||
static void TupleToJsoninfo(
|
||||
cJSON* cols_name, cJSON* cols_type, cJSON* cols_val, TupleDesc tupdesc, HeapTuple tuple, bool skip_nulls)
|
||||
static void TupleToJsoninfo(Relation relation, cJSON* cols_name, cJSON* cols_type, cJSON* cols_val, TupleDesc tupdesc,
|
||||
HeapTuple tuple, bool isOld)
|
||||
{
|
||||
if ((tuple->tupTableType == HEAP_TUPLE) && (HEAP_TUPLE_IS_COMPRESSED(tuple->t_data) ||
|
||||
(int)HeapTupleHeaderGetNatts(tuple->t_data, tupdesc) > tupdesc->natts)) {
|
||||
|
|
@ -241,7 +241,7 @@ static void TupleToJsoninfo(
|
|||
Datum origval = 0; /* possibly toasted Datum */
|
||||
bool isnull = false; /* column is null? */
|
||||
|
||||
Form_pg_attribute attr = tupdesc->attrs[natt]; /* the attribute itself */
|
||||
Form_pg_attribute attr = &tupdesc->attrs[natt]; /* the attribute itself */
|
||||
|
||||
/*
|
||||
* don't print dropped columns, we can't be sure everything is
|
||||
|
|
@ -254,7 +254,7 @@ static void TupleToJsoninfo(
|
|||
* Don't print system columns, oid will already have been printed if
|
||||
* present.
|
||||
*/
|
||||
if (attr->attnum < 0)
|
||||
if (attr->attnum < 0 || (isOld && !IsRelationReplidentKey(relation, attr->attnum)))
|
||||
continue;
|
||||
|
||||
Oid typid = attr->atttypid; /* type of current attribute */
|
||||
|
|
@ -265,8 +265,6 @@ static void TupleToJsoninfo(
|
|||
} else {
|
||||
origval = uheap_getattr((UHeapTuple)tuple, natt + 1, tupdesc, &isnull);
|
||||
}
|
||||
if (isnull && skip_nulls)
|
||||
continue;
|
||||
|
||||
/* print attribute name */
|
||||
|
||||
|
|
@ -355,53 +353,53 @@ static void pg_decode_change(
|
|||
case REORDER_BUFFER_CHANGE_INSERT:
|
||||
op_type = cJSON_CreateString("INSERT");
|
||||
if (change->data.tp.newtuple != NULL) {
|
||||
TupleToJsoninfo(
|
||||
columns_name, columns_type, columns_val, tupdesc, &change->data.tp.newtuple->tuple, false);
|
||||
TupleToJsoninfo(relation, columns_name, columns_type, columns_val, tupdesc,
|
||||
&change->data.tp.newtuple->tuple, false);
|
||||
}
|
||||
break;
|
||||
case REORDER_BUFFER_CHANGE_UPDATE:
|
||||
op_type = cJSON_CreateString("UPDATE");
|
||||
if (change->data.tp.oldtuple != NULL) {
|
||||
TupleToJsoninfo(
|
||||
old_keys_name, old_keys_type, old_keys_val, tupdesc, &change->data.tp.oldtuple->tuple, true);
|
||||
TupleToJsoninfo(relation, old_keys_name, old_keys_type, old_keys_val, tupdesc,
|
||||
&change->data.tp.oldtuple->tuple, true);
|
||||
}
|
||||
|
||||
if (change->data.tp.newtuple != NULL) {
|
||||
TupleToJsoninfo(
|
||||
columns_name, columns_type, columns_val, tupdesc, &change->data.tp.newtuple->tuple, false);
|
||||
TupleToJsoninfo(relation, columns_name, columns_type, columns_val, tupdesc,
|
||||
&change->data.tp.newtuple->tuple, false);
|
||||
}
|
||||
break;
|
||||
case REORDER_BUFFER_CHANGE_DELETE:
|
||||
op_type = cJSON_CreateString("DELETE");
|
||||
if (change->data.tp.oldtuple != NULL) {
|
||||
TupleToJsoninfo(
|
||||
old_keys_name, old_keys_type, old_keys_val, tupdesc, &change->data.tp.oldtuple->tuple, true);
|
||||
TupleToJsoninfo(relation, old_keys_name, old_keys_type, old_keys_val, tupdesc,
|
||||
&change->data.tp.oldtuple->tuple, true);
|
||||
}
|
||||
/* if there was no PK, we only know that a delete happened */
|
||||
break;
|
||||
case REORDER_BUFFER_CHANGE_UINSERT:
|
||||
op_type = cJSON_CreateString("INSERT");
|
||||
if (change->data.utp.newtuple != NULL) {
|
||||
TupleToJsoninfo(columns_name, columns_type, columns_val, tupdesc,
|
||||
TupleToJsoninfo(relation, columns_name, columns_type, columns_val, tupdesc,
|
||||
(HeapTuple)(&change->data.utp.newtuple->tuple), false);
|
||||
}
|
||||
break;
|
||||
case REORDER_BUFFER_CHANGE_UDELETE:
|
||||
op_type = cJSON_CreateString("DELETE");
|
||||
if (change->data.utp.oldtuple != NULL) {
|
||||
TupleToJsoninfo(old_keys_name, old_keys_type, old_keys_val, tupdesc,
|
||||
TupleToJsoninfo(relation, old_keys_name, old_keys_type, old_keys_val, tupdesc,
|
||||
(HeapTuple)(&change->data.utp.oldtuple->tuple), true);
|
||||
}
|
||||
break;
|
||||
case REORDER_BUFFER_CHANGE_UUPDATE:
|
||||
op_type = cJSON_CreateString("UPDATE");
|
||||
if (change->data.utp.oldtuple != NULL) {
|
||||
TupleToJsoninfo(old_keys_name, old_keys_type, old_keys_val, tupdesc,
|
||||
TupleToJsoninfo(relation, old_keys_name, old_keys_type, old_keys_val, tupdesc,
|
||||
(HeapTuple)(&change->data.utp.oldtuple->tuple), true);
|
||||
}
|
||||
|
||||
if (change->data.utp.newtuple != NULL) {
|
||||
TupleToJsoninfo(columns_name, columns_type, columns_val, tupdesc,
|
||||
TupleToJsoninfo(relation, columns_name, columns_type, columns_val, tupdesc,
|
||||
(HeapTuple)&change->data.utp.newtuple->tuple, false);
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -3160,8 +3160,9 @@ static int parse_page_file(const char *filename, SegmentType type, const uint32
|
|||
char decompressed[BLCKSZ];
|
||||
while (start < number) {
|
||||
size_t compressedSize = pageCompression->ReadCompressedBuffer(start, compressed, BLCKSZ);
|
||||
if (compressedSize == 0) {
|
||||
fprintf(stderr, "read block %u failed, filename: %s: %s\n", start, filename, strerror(errno));
|
||||
if (compressedSize > MIN_COMPRESS_ERROR_RT) {
|
||||
fprintf(stderr, "read block %u failed, filename: %s: code: %lu %s\n",
|
||||
start, filename, compressedSize, strerror(errno));
|
||||
delete pageCompression;
|
||||
return false;
|
||||
}
|
||||
|
|
@ -5435,6 +5436,7 @@ static void fill_filenode_map(char** class_map)
|
|||
{"pg_cast_source_target_index", 2661},
|
||||
{"pg_class_oid_index", 2662},
|
||||
{"pg_class_relname_nsp_index", 2663},
|
||||
{"pg_collation_enc_def_index", 3147},
|
||||
{"pg_collation_name_enc_nsp_index", 3164},
|
||||
{"pg_collation_oid_index", 3085},
|
||||
{"pg_constraint_conname_nsp_index", 2664},
|
||||
|
|
|
|||
|
|
@ -435,7 +435,7 @@ static void parse_compress_meta(StringInfo outputBuf, char* page_content, Relati
|
|||
int size = PageGetSpecialSize(page_header);
|
||||
|
||||
TupleDesc desc = RelationGetDescr(rel);
|
||||
Form_pg_attribute* att = desc->attrs;
|
||||
FormData_pg_attribute* att = desc->attrs;
|
||||
int attrno;
|
||||
int attrnum = desc->natts;
|
||||
|
||||
|
|
@ -444,7 +444,7 @@ static void parse_compress_meta(StringInfo outputBuf, char* page_content, Relati
|
|||
char mode = 0;
|
||||
|
||||
for (attrno = 0; attrno < attrnum && cmprsOff < size; ++attrno) {
|
||||
Form_pg_attribute thisatt = att[attrno];
|
||||
Form_pg_attribute thisatt = &att[attrno];
|
||||
int metaSize = 0;
|
||||
|
||||
metaInfo = PageCompress::FetchAttrCmprMeta(start + cmprsOff, thisatt->attlen, &metaSize, &mode);
|
||||
|
|
|
|||
|
|
@ -223,12 +223,14 @@ static void pgss_ExecutorStart(QueryDesc* queryDesc, int eflags);
|
|||
static void pgss_ExecutorRun(QueryDesc* queryDesc, ScanDirection direction, long count);
|
||||
static void pgss_ExecutorFinish(QueryDesc* queryDesc);
|
||||
static void pgss_ExecutorEnd(QueryDesc* queryDesc);
|
||||
static void pgss_ProcessUtility(Node* parsetree, const char* queryString, ParamListInfo params, bool isTopLevel,
|
||||
static void pgss_ProcessUtility(processutility_context* processutility_cxt,
|
||||
DestReceiver* dest,
|
||||
#ifdef PGXC
|
||||
bool sentToRemote,
|
||||
#endif /* PGXC */
|
||||
char* completionTag);
|
||||
char* completionTag,
|
||||
ProcessUtilityContext context,
|
||||
bool isCTAS);
|
||||
static uint32 pgss_hash_fn(const void* key, Size keysize);
|
||||
static int pgss_match_fn(const void* key1, const void* key2, Size keysize);
|
||||
static uint32 pgss_hash_string(const char* str);
|
||||
|
|
@ -722,13 +724,17 @@ static void pgss_ExecutorEnd(QueryDesc* queryDesc)
|
|||
/*
|
||||
* ProcessUtility hook
|
||||
*/
|
||||
static void pgss_ProcessUtility(Node* parsetree, const char* queryString, ParamListInfo params, bool isTopLevel,
|
||||
static void pgss_ProcessUtility(processutility_context* processutility_cxt,
|
||||
DestReceiver* dest,
|
||||
#ifdef PGXC
|
||||
bool sentToRemote,
|
||||
#endif /* PGXC */
|
||||
char* completionTag)
|
||||
char* completionTag,
|
||||
ProcessUtilityContext context,
|
||||
bool isCTAS)
|
||||
{
|
||||
Node* parsetree = processutility_cxt->parse_tree;
|
||||
const char* queryString = processutility_cxt->query_string;
|
||||
/*
|
||||
* If it's an EXECUTE statement, we don't track it and don't increment the
|
||||
* nesting level. This allows the cycles to be charged to the underlying
|
||||
|
|
@ -754,25 +760,23 @@ static void pgss_ProcessUtility(Node* parsetree, const char* queryString, ParamL
|
|||
PG_TRY();
|
||||
{
|
||||
if (prev_ProcessUtility)
|
||||
prev_ProcessUtility(parsetree,
|
||||
queryString,
|
||||
params,
|
||||
isTopLevel,
|
||||
prev_ProcessUtility(processutility_cxt,
|
||||
dest,
|
||||
#ifdef PGXC
|
||||
sentToRemote,
|
||||
#endif /* PGXC */
|
||||
completionTag);
|
||||
completionTag,
|
||||
context,
|
||||
isCTAS);
|
||||
else
|
||||
standard_ProcessUtility(parsetree,
|
||||
queryString,
|
||||
params,
|
||||
isTopLevel,
|
||||
standard_ProcessUtility(processutility_cxt,
|
||||
dest,
|
||||
#ifdef PGXC
|
||||
sentToRemote,
|
||||
#endif /* PGXC */
|
||||
completionTag);
|
||||
completionTag,
|
||||
context,
|
||||
isCTAS);
|
||||
nested_level--;
|
||||
}
|
||||
PG_CATCH();
|
||||
|
|
@ -817,25 +821,23 @@ static void pgss_ProcessUtility(Node* parsetree, const char* queryString, ParamL
|
|||
pgss_store(queryString, queryId, INSTR_TIME_GET_MILLISEC(duration), rows, &bufusage, NULL);
|
||||
} else {
|
||||
if (prev_ProcessUtility)
|
||||
prev_ProcessUtility(parsetree,
|
||||
queryString,
|
||||
params,
|
||||
isTopLevel,
|
||||
prev_ProcessUtility(processutility_cxt,
|
||||
dest,
|
||||
#ifdef PGXC
|
||||
sentToRemote,
|
||||
#endif /* PGXC */
|
||||
completionTag);
|
||||
completionTag,
|
||||
context,
|
||||
isCTAS);
|
||||
else
|
||||
standard_ProcessUtility(parsetree,
|
||||
queryString,
|
||||
params,
|
||||
isTopLevel,
|
||||
standard_ProcessUtility(processutility_cxt,
|
||||
dest,
|
||||
#ifdef PGXC
|
||||
sentToRemote,
|
||||
#endif /* PGXC */
|
||||
completionTag);
|
||||
completionTag,
|
||||
context,
|
||||
isCTAS);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1858,7 +1860,7 @@ static void fill_in_constant_lengths(pgssJumbleState* jstate, const char* query)
|
|||
locs = jstate->clocations;
|
||||
|
||||
/* initialize the flex scanner --- should match raw_parser() */
|
||||
yyscanner = scanner_init(query, &yyextra, ScanKeywords, NumScanKeywords);
|
||||
yyscanner = scanner_init(query, &yyextra, &ScanKeywords, ScanKeywordTokens);
|
||||
|
||||
/* Search for each constant, in sequence */
|
||||
for (i = 0; i < jstate->clocations_count; i++) {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
*/
|
||||
#include "postgres.h"
|
||||
#include "knl/knl_variable.h"
|
||||
#include "port/pg_bitutils.h"
|
||||
|
||||
#include "trgm.h"
|
||||
|
||||
|
|
@ -40,264 +41,6 @@ extern "C" Datum gtrgm_picksplit(PG_FUNCTION_ARGS);
|
|||
|
||||
#define GETENTRY(vec, pos) ((TRGM*)DatumGetPointer((vec)->vector[(pos)].key))
|
||||
|
||||
/* Number of one-bits in an unsigned byte */
|
||||
static const uint8 number_of_ones[256] = {0,
|
||||
1,
|
||||
1,
|
||||
2,
|
||||
1,
|
||||
2,
|
||||
2,
|
||||
3,
|
||||
1,
|
||||
2,
|
||||
2,
|
||||
3,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
1,
|
||||
2,
|
||||
2,
|
||||
3,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
1,
|
||||
2,
|
||||
2,
|
||||
3,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
4,
|
||||
5,
|
||||
5,
|
||||
6,
|
||||
1,
|
||||
2,
|
||||
2,
|
||||
3,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
4,
|
||||
5,
|
||||
5,
|
||||
6,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
4,
|
||||
5,
|
||||
5,
|
||||
6,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
4,
|
||||
5,
|
||||
5,
|
||||
6,
|
||||
4,
|
||||
5,
|
||||
5,
|
||||
6,
|
||||
5,
|
||||
6,
|
||||
6,
|
||||
7,
|
||||
1,
|
||||
2,
|
||||
2,
|
||||
3,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
4,
|
||||
5,
|
||||
5,
|
||||
6,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
4,
|
||||
5,
|
||||
5,
|
||||
6,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
4,
|
||||
5,
|
||||
5,
|
||||
6,
|
||||
4,
|
||||
5,
|
||||
5,
|
||||
6,
|
||||
5,
|
||||
6,
|
||||
6,
|
||||
7,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
4,
|
||||
5,
|
||||
5,
|
||||
6,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
4,
|
||||
5,
|
||||
5,
|
||||
6,
|
||||
4,
|
||||
5,
|
||||
5,
|
||||
6,
|
||||
5,
|
||||
6,
|
||||
6,
|
||||
7,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
4,
|
||||
5,
|
||||
5,
|
||||
6,
|
||||
4,
|
||||
5,
|
||||
5,
|
||||
6,
|
||||
5,
|
||||
6,
|
||||
6,
|
||||
7,
|
||||
4,
|
||||
5,
|
||||
5,
|
||||
6,
|
||||
5,
|
||||
6,
|
||||
6,
|
||||
7,
|
||||
5,
|
||||
6,
|
||||
6,
|
||||
7,
|
||||
6,
|
||||
7,
|
||||
7,
|
||||
8};
|
||||
|
||||
Datum gtrgm_in(PG_FUNCTION_ARGS)
|
||||
{
|
||||
elog(ERROR, "not implemented");
|
||||
|
|
@ -677,11 +420,7 @@ Datum gtrgm_same(PG_FUNCTION_ARGS)
|
|||
|
||||
static int4 sizebitvec(BITVECP sign)
|
||||
{
|
||||
int4 size = 0, i;
|
||||
|
||||
LOOPBYTE
|
||||
size += number_of_ones[(unsigned char)sign[i]];
|
||||
return size;
|
||||
return pg_popcount(sign, SIGLEN);
|
||||
}
|
||||
|
||||
static int hemdistsign(BITVECP a, BITVECP b)
|
||||
|
|
@ -691,7 +430,8 @@ static int hemdistsign(BITVECP a, BITVECP b)
|
|||
LOOPBYTE
|
||||
{
|
||||
diff = (unsigned char)(a[i] ^ b[i]);
|
||||
dist += number_of_ones[diff];
|
||||
/* Using the popcount functions here isn't likely to win */
|
||||
dist += pg_number_of_ones[diff];
|
||||
}
|
||||
return dist;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1038,6 +1038,9 @@ int main(int argc, char** argv)
|
|||
}
|
||||
}
|
||||
|
||||
if (dumpprivate.enable_dss)
|
||||
XLogSegmentSize = DSS_XLOG_SEG_SIZE;
|
||||
|
||||
/* parse files as start/end boundaries, extract path if not specified */
|
||||
if (optind < argc) {
|
||||
char* directory = NULL;
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ static bool foreign_expr_walker(Node *node, foreign_glob_cxt *glob_cxt, foreign_
|
|||
static void deparseTargetList(StringInfo buf, RangeTblEntry *rte, Index rtindex, Relation rel, bool is_returning,
|
||||
Bitmapset *attrs_used, bool qualify_col, List **retrieved_attrs);
|
||||
static void deparseReturningList(StringInfo buf, RangeTblEntry *root, Index rtindex, Relation rel, bool trig_after_row,
|
||||
List *returningList, List **retrieved_attrs);
|
||||
List *withCheckOptionList, List *returningList, List **retrieved_attrs);
|
||||
static void deparseColumnRef(StringInfo buf, int varno, int varattno, RangeTblEntry *rte, bool qualify_col);
|
||||
static void deparseRelation(StringInfo buf, Relation rel);
|
||||
static void deparseStringLiteral(StringInfo buf, const char *val);
|
||||
|
|
@ -1158,7 +1158,7 @@ List *build_tlist_to_deparse(RelOptInfo *foreignrel)
|
|||
* We require columns specified in foreignrel->reltarget->exprs and those
|
||||
* required for evaluating the local conditions.
|
||||
*/
|
||||
tlist = add_to_flat_tlist(tlist, pull_var_clause((Node *)foreignrel->reltargetlist, PVC_RECURSE_AGGREGATES, PVC_RECURSE_PLACEHOLDERS));
|
||||
tlist = add_to_flat_tlist(tlist, pull_var_clause((Node *)foreignrel->reltarget->exprs, PVC_RECURSE_AGGREGATES, PVC_RECURSE_PLACEHOLDERS));
|
||||
foreach (lc, fpinfo->local_conds) {
|
||||
RestrictInfo *rinfo = (RestrictInfo *)lfirst_node(RestrictInfo, lc);
|
||||
|
||||
|
|
@ -1548,7 +1548,7 @@ static void deparseSubqueryTargetList(deparse_expr_cxt *context)
|
|||
Assert(IS_SIMPLE_REL(foreignrel) || IS_JOIN_REL(foreignrel));
|
||||
|
||||
first = true;
|
||||
foreach (lc, foreignrel->reltargetlist) {
|
||||
foreach (lc, foreignrel->reltarget->exprs) {
|
||||
Node *node = (Node *)lfirst(lc);
|
||||
|
||||
if (!first) {
|
||||
|
|
@ -1821,7 +1821,7 @@ static void deparseRangeTblRef(StringInfo buf, PlannerInfo *root, RelOptInfo *fo
|
|||
* expressions specified in the relation's reltarget (see
|
||||
* deparseSubqueryTargetList).
|
||||
*/
|
||||
ncols = list_length(foreignrel->reltargetlist);
|
||||
ncols = list_length(foreignrel->reltarget->exprs);
|
||||
if (ncols > 0) {
|
||||
int i;
|
||||
|
||||
|
|
@ -1844,11 +1844,11 @@ static void deparseRangeTblRef(StringInfo buf, PlannerInfo *root, RelOptInfo *fo
|
|||
* deparse remote INSERT statement
|
||||
*
|
||||
* The statement text is appended to buf, and we also create an integer List
|
||||
* of the columns being retrieved by RETURNING (if any), which is returned
|
||||
* to *retrieved_attrs.
|
||||
* of the columns being retrieved by WITH CHECK OPTION or RETURNING (if any),
|
||||
* which is returned to *retrieved_attrs.
|
||||
*/
|
||||
void deparseInsertSql(StringInfo buf, RangeTblEntry *rte, Index rtindex, Relation rel, List *targetAttrs,
|
||||
List *returningList, List **retrieved_attrs)
|
||||
List *withCheckOptionList, List *returningList, List **retrieved_attrs)
|
||||
{
|
||||
AttrNumber pindex;
|
||||
ListCell *lc = NULL;
|
||||
|
|
@ -1890,19 +1890,19 @@ void deparseInsertSql(StringInfo buf, RangeTblEntry *rte, Index rtindex, Relatio
|
|||
appendStringInfoString(buf, " DEFAULT VALUES");
|
||||
}
|
||||
|
||||
deparseReturningList(buf, rte, rtindex, rel, rel->trigdesc && rel->trigdesc->trig_insert_after_row, returningList,
|
||||
retrieved_attrs);
|
||||
deparseReturningList(buf, rte, rtindex, rel, rel->trigdesc && rel->trigdesc->trig_insert_after_row,
|
||||
withCheckOptionList, returningList, retrieved_attrs);
|
||||
}
|
||||
|
||||
/*
|
||||
* deparse remote UPDATE statement
|
||||
*
|
||||
* The statement text is appended to buf, and we also create an integer List
|
||||
* of the columns being retrieved by RETURNING (if any), which is returned
|
||||
* to *retrieved_attrs.
|
||||
* of the columns being retrieved by WITH CHECK OPTION or RETURNING (if any),
|
||||
* which is returned to *retrieved_attrs.
|
||||
*/
|
||||
void deparseUpdateSql(StringInfo buf, RangeTblEntry *rte, Index rtindex, Relation rel, List *targetAttrs,
|
||||
List *returningList, List **retrieved_attrs)
|
||||
List *withCheckOptionList, List *returningList, List **retrieved_attrs)
|
||||
{
|
||||
AttrNumber pindex;
|
||||
ListCell *lc = NULL;
|
||||
|
|
@ -1927,8 +1927,8 @@ void deparseUpdateSql(StringInfo buf, RangeTblEntry *rte, Index rtindex, Relatio
|
|||
}
|
||||
appendStringInfoString(buf, " WHERE ctid = $1 and tableoid = $2");
|
||||
|
||||
deparseReturningList(buf, rte, rtindex, rel, rel->trigdesc && rel->trigdesc->trig_update_after_row, returningList,
|
||||
retrieved_attrs);
|
||||
deparseReturningList(buf, rte, rtindex, rel, rel->trigdesc && rel->trigdesc->trig_update_after_row,
|
||||
withCheckOptionList, returningList, retrieved_attrs);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -1945,15 +1945,15 @@ void deparseDeleteSql(StringInfo buf, RangeTblEntry *rte, Index rtindex, Relatio
|
|||
deparseRelation(buf, rel);
|
||||
appendStringInfoString(buf, " WHERE ctid = $1 and tableoid = $2");
|
||||
|
||||
deparseReturningList(buf, rte, rtindex, rel, rel->trigdesc && rel->trigdesc->trig_delete_after_row, returningList,
|
||||
retrieved_attrs);
|
||||
deparseReturningList(buf, rte, rtindex, rel, rel->trigdesc && rel->trigdesc->trig_delete_after_row, NIL,
|
||||
returningList, retrieved_attrs);
|
||||
}
|
||||
|
||||
/*
|
||||
* Add a RETURNING clause, if needed, to an INSERT/UPDATE/DELETE.
|
||||
*/
|
||||
static void deparseReturningList(StringInfo buf, RangeTblEntry *rte, Index rtindex, Relation rel, bool trig_after_row,
|
||||
List *returningList, List **retrieved_attrs)
|
||||
List *withCheckOptionList, List *returningList, List **retrieved_attrs)
|
||||
{
|
||||
Bitmapset *attrs_used = NULL;
|
||||
|
||||
|
|
@ -1962,6 +1962,19 @@ static void deparseReturningList(StringInfo buf, RangeTblEntry *rte, Index rtind
|
|||
attrs_used = bms_make_singleton(0 - FirstLowInvalidHeapAttributeNumber);
|
||||
}
|
||||
|
||||
if (withCheckOptionList != NIL) {
|
||||
/*
|
||||
* We need the attrs, non-system and system, mentioned in the local
|
||||
* query's WITH CHECK OPTION list.
|
||||
*
|
||||
* Note: we do this to ensure that WCO constraints will be evaluated
|
||||
* on the data actually inserted/updated on the remote side, which
|
||||
* might differ from the data supplied by the core code, for example
|
||||
* as a result of remote triggers.
|
||||
*/
|
||||
pull_varattnos((Node*)withCheckOptionList, rtindex, &attrs_used);
|
||||
}
|
||||
|
||||
if (returningList != NIL) {
|
||||
/*
|
||||
* We need the attrs, non-system and system, mentioned in the local
|
||||
|
|
@ -2017,7 +2030,7 @@ void deparseAnalyzeSql(StringInfo buf, Relation rel, List **retrieved_attrs)
|
|||
appendStringInfoString(buf, "SELECT ");
|
||||
for (i = 0; i < tupdesc->natts; i++) {
|
||||
/* Ignore dropped columns. */
|
||||
if (tupdesc->attrs[i]->attisdropped) {
|
||||
if (tupdesc->attrs[i].attisdropped) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -2027,7 +2040,7 @@ void deparseAnalyzeSql(StringInfo buf, Relation rel, List **retrieved_attrs)
|
|||
first = false;
|
||||
|
||||
/* Use attribute name or column_name option. */
|
||||
char *colname = NameStr(tupdesc->attrs[i]->attname);
|
||||
char *colname = NameStr(tupdesc->attrs[i].attname);
|
||||
List *options = GetForeignColumnOptions(relid, i + 1);
|
||||
|
||||
foreach (lc, options) {
|
||||
|
|
@ -3385,7 +3398,7 @@ static void get_relation_column_alias_ids(Var *node, RelOptInfo *foreignrel, int
|
|||
|
||||
/* Get the column alias ID */
|
||||
i = 1;
|
||||
foreach (lc, foreignrel->reltargetlist) {
|
||||
foreach (lc, foreignrel->reltarget->exprs) {
|
||||
if (equal(lfirst(lc), (Node *)node)) {
|
||||
*colno = i;
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -1394,18 +1394,18 @@ SELECT * FROM ft1 t1 WHERE t1.c1 === t1.c2 order by t1.c2 limit 1;
|
|||
|
||||
-- case when expr
|
||||
explain (verbose, costs off) select * from ft1 where case c1 when 1 then 0 end = 0;
|
||||
QUERY PLAN
|
||||
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
QUERY PLAN
|
||||
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
Foreign Scan on public.ft1
|
||||
Output: c1, c2, c3, c4, c5, c6, c7, c8
|
||||
Node ID: 1
|
||||
Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" WHERE (((CASE "C 1" WHEN 1 THEN 0::numeric ELSE NULL::numeric END) = 0::numeric))
|
||||
Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" WHERE (((CASE "C 1" WHEN 1 THEN 0 ELSE NULL::integer END) = 0))
|
||||
|
||||
FDW remote plans:
|
||||
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" WHERE (((CASE "C 1" WHEN 1 THEN 0::numeric ELSE NULL::numeric END) = 0::numeric))
|
||||
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" WHERE (((CASE "C 1" WHEN 1 THEN 0 ELSE NULL::integer END) = 0))
|
||||
Seq Scan on "S 1"."T 1"
|
||||
Output: "C 1", c2, c3, c4, c5, c6, c7, c8
|
||||
Filter: (CASE "T 1"."C 1" WHEN 1 THEN 0::numeric ELSE NULL::numeric END = 0::numeric)
|
||||
Filter: (CASE "T 1"."C 1" WHEN 1 THEN 0 ELSE NULL::integer END = 0)
|
||||
|
||||
(11 rows)
|
||||
|
||||
|
|
@ -4698,7 +4698,6 @@ create operator public.>^ (
|
|||
procedure = int4gt
|
||||
);
|
||||
create operator family my_op_family using btree;
|
||||
ERROR: user defined operator is not yet supported.
|
||||
create function my_op_cmp(a int, b int) returns int as
|
||||
$$begin return btint4cmp(a, b); end $$ language plpgsql;
|
||||
create operator class my_op_class for type int using btree family my_op_family as
|
||||
|
|
@ -4706,23 +4705,34 @@ create operator class my_op_class for type int using btree family my_op_family a
|
|||
operator 3 public.=^,
|
||||
operator 5 public.>^,
|
||||
function 1 my_op_cmp(int, int);
|
||||
ERROR: operator family "my_op_family" does not exist for access method "btree"
|
||||
-- NOTICES:
|
||||
-- openGauss not support create operator class. remove the case. If you want to restore the test case later, refer to README in the file header.
|
||||
-- This will not be pushed as sort operator is now removed from the extension.
|
||||
explain (verbose, costs off)
|
||||
select array_agg(c1 order by c1 using operator(public.<^)) from ft2 where c2 = 6 and c1 < 100 group by c2;
|
||||
ERROR: operator <^ is not a valid ordering operator
|
||||
LINE 2: select array_agg(c1 order by c1 using operator(public.<^)) f...
|
||||
^
|
||||
HINT: Ordering operators must be "<" or ">" members of btree operator families.
|
||||
CONTEXT: referenced column: array_agg
|
||||
QUERY PLAN
|
||||
-----------------------------------------------------------------------------------------------------------------
|
||||
GroupAggregate
|
||||
Output: array_agg(c1 ORDER BY c1 USING <^ NULLS LAST), c2
|
||||
Group By Key: ft2.c2
|
||||
-> Foreign Scan on public.ft2
|
||||
Output: c2, c1
|
||||
Node ID: 1
|
||||
Remote SQL: SELECT "C 1", c2 FROM "S 1"."T 1" WHERE (("C 1" < 100)) AND ((c2 = 6))
|
||||
|
||||
FDW remote plans:
|
||||
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT "C 1", c2 FROM "S 1"."T 1" WHERE (("C 1" < 100)) AND ((c2 = 6))
|
||||
Index Scan using t1_pkey on "S 1"."T 1"
|
||||
Output: "C 1", c2
|
||||
Index Cond: ("T 1"."C 1" < 100)
|
||||
Filter: ("T 1".c2 = 6)
|
||||
|
||||
(15 rows)
|
||||
|
||||
-- Cleanup
|
||||
drop operator class my_op_class using btree;
|
||||
ERROR: operator class "my_op_class" does not exist for access method "btree"
|
||||
drop function my_op_cmp(a int, b int);
|
||||
drop operator family my_op_family using btree;
|
||||
ERROR: operator family "my_op_family" does not exist for access method "btree"
|
||||
drop operator public.>^(int, int);
|
||||
drop operator public.=^(int, int);
|
||||
drop operator public.<^(int, int);
|
||||
|
|
@ -8381,22 +8391,348 @@ UPDATE ft1 SET c2 = c2 + 1 WHERE c1 = 1;
|
|||
ALTER FOREIGN TABLE ft1 DROP CONSTRAINT ft1_c2negative;
|
||||
ERROR: constraint "ft1_c2negative" of relation "ft1" does not exist
|
||||
-- ======================================================================================================================================
|
||||
-- TEST-MODULE: WITH CHECK OPTION constraints
|
||||
-- TEST-MODULE: IUD VIEW and WITH CHECK OPTION constraints
|
||||
-- --------------------------------------
|
||||
-- openGauss not support WITH CHECK OPTION, so this test module is unuseful and cannot be fixed, remove it.
|
||||
-- ======================================================================================================================================
|
||||
CREATE FUNCTION row_before_insupd_trigfunc() RETURNS trigger AS $$BEGIN NEW.a := NEW.a + 10; RETURN NEW; END$$ LANGUAGE plpgsql;
|
||||
CREATE TABLE base_tbl (a int, b int);
|
||||
CREATE TABLE base_tbl (id int, a int, b int);
|
||||
ALTER TABLE base_tbl SET (autovacuum_enabled = 'false');
|
||||
CREATE FOREIGN TABLE foreign_tbl (id int, a int, b int) SERVER loopback OPTIONS (table_name 'base_tbl');
|
||||
CREATE VIEW rw_view1 AS SELECT * FROM foreign_tbl WHERE a < b and id = 1;
|
||||
CREATE VIEW rw_view2 AS SELECT * FROM foreign_tbl WHERE a < b and id = 2 WITH CHECK OPTION;
|
||||
\d+ rw_view1
|
||||
View "public.rw_view1"
|
||||
Column | Type | Modifiers | Storage | Description
|
||||
--------+---------+-----------+---------+-------------
|
||||
id | integer | | plain |
|
||||
a | integer | | plain |
|
||||
b | integer | | plain |
|
||||
View definition:
|
||||
SELECT *
|
||||
FROM foreign_tbl
|
||||
WHERE foreign_tbl.a < foreign_tbl.b AND foreign_tbl.id = 1;
|
||||
|
||||
\d+ rw_view2
|
||||
View "public.rw_view2"
|
||||
Column | Type | Modifiers | Storage | Description
|
||||
--------+---------+-----------+---------+-------------
|
||||
id | integer | | plain |
|
||||
a | integer | | plain |
|
||||
b | integer | | plain |
|
||||
View definition:
|
||||
SELECT *
|
||||
FROM foreign_tbl
|
||||
WHERE foreign_tbl.a < foreign_tbl.b AND foreign_tbl.id = 2;
|
||||
Options: check_option=cascaded
|
||||
|
||||
CREATE OR REPLACE FUNCTION checkdata(out tbname text, out id int, out a int, out b int) RETURNS SETOF record as $$
|
||||
select * from (
|
||||
(select 'rw_view1', * from rw_view1 where id = 1) union all
|
||||
(select 'rw_view2', * from rw_view2 where id = 2) union all
|
||||
(select 'base_tbl', * from base_tbl) union all
|
||||
(select 'foreign_tbl', * from foreign_tbl)
|
||||
) data(tbname, id, a, b)
|
||||
order by 1,2,3,4;
|
||||
$$ language sql;
|
||||
-- simple case
|
||||
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view1 VALUES (1, 0, 5); -- should success
|
||||
QUERY PLAN
|
||||
------------------------------
|
||||
Insert on public.foreign_tbl
|
||||
-> Result
|
||||
Output: 1, 0, 5
|
||||
(3 rows)
|
||||
|
||||
INSERT INTO rw_view1 VALUES (1, 0, 5);
|
||||
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view1 VALUES (1, 10, 5); -- should success
|
||||
QUERY PLAN
|
||||
------------------------------
|
||||
Insert on public.foreign_tbl
|
||||
-> Result
|
||||
Output: 1, 10, 5
|
||||
(3 rows)
|
||||
|
||||
INSERT INTO rw_view1 VALUES (1, 10, 5);
|
||||
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view2 VALUES (2, 0, 5); -- should success
|
||||
QUERY PLAN
|
||||
------------------------------
|
||||
Insert on public.foreign_tbl
|
||||
-> Result
|
||||
Output: 2, 0, 5
|
||||
(3 rows)
|
||||
|
||||
INSERT INTO rw_view2 VALUES (2, 0, 5);
|
||||
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view2 VALUES (2, 10, 5); -- should failed
|
||||
QUERY PLAN
|
||||
------------------------------
|
||||
Insert on public.foreign_tbl
|
||||
-> Result
|
||||
Output: 2, 10, 5
|
||||
(3 rows)
|
||||
|
||||
INSERT INTO rw_view2 VALUES (2, 10, 5);
|
||||
ERROR: new row violates WITH CHECK OPTION for view "rw_view2"
|
||||
DETAIL: Failing row contains (2, 10, 5).
|
||||
select * from checkdata();
|
||||
tbname | id | a | b
|
||||
-------------+----+----+---
|
||||
base_tbl | 1 | 0 | 5
|
||||
base_tbl | 1 | 10 | 5
|
||||
base_tbl | 2 | 0 | 5
|
||||
foreign_tbl | 1 | 0 | 5
|
||||
foreign_tbl | 1 | 10 | 5
|
||||
foreign_tbl | 2 | 0 | 5
|
||||
rw_view1 | 1 | 0 | 5
|
||||
rw_view2 | 2 | 0 | 5
|
||||
(8 rows)
|
||||
|
||||
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view1 SET a = a + 20 where id = 1; -- should success
|
||||
QUERY PLAN
|
||||
------------------------------------------------------------------------------------------------------------------------------
|
||||
Update on public.foreign_tbl
|
||||
-> Foreign Scan on public.foreign_tbl
|
||||
Output: foreign_tbl.id, (foreign_tbl.a + 20), foreign_tbl.b, foreign_tbl.ctid, foreign_tbl.tableoid
|
||||
Node ID: 1
|
||||
Remote SQL: SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 1))
|
||||
|
||||
FDW remote plans:
|
||||
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 1))
|
||||
Seq Scan on public.base_tbl
|
||||
Output: id, a, b, ctid, tableoid
|
||||
Filter: ((base_tbl.a < base_tbl.b) AND (base_tbl.id = 1))
|
||||
|
||||
(12 rows)
|
||||
|
||||
UPDATE rw_view1 SET a = a + 20 where id = 1;
|
||||
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view2 SET a = a + 20 where id = 2; -- should failed
|
||||
QUERY PLAN
|
||||
------------------------------------------------------------------------------------------------------------------------------
|
||||
Update on public.foreign_tbl
|
||||
-> Foreign Scan on public.foreign_tbl
|
||||
Output: foreign_tbl.id, (foreign_tbl.a + 20), foreign_tbl.b, foreign_tbl.ctid, foreign_tbl.tableoid
|
||||
Node ID: 1
|
||||
Remote SQL: SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 2))
|
||||
|
||||
FDW remote plans:
|
||||
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 2))
|
||||
Seq Scan on public.base_tbl
|
||||
Output: id, a, b, ctid, tableoid
|
||||
Filter: ((base_tbl.a < base_tbl.b) AND (base_tbl.id = 2))
|
||||
|
||||
(12 rows)
|
||||
|
||||
UPDATE rw_view2 SET a = a + 20 where id = 2;
|
||||
ERROR: new row violates WITH CHECK OPTION for view "rw_view2"
|
||||
DETAIL: Failing row contains (2, 20, 5).
|
||||
select * from checkdata();
|
||||
tbname | id | a | b
|
||||
-------------+----+----+---
|
||||
base_tbl | 1 | 10 | 5
|
||||
base_tbl | 1 | 20 | 5
|
||||
base_tbl | 2 | 0 | 5
|
||||
foreign_tbl | 1 | 10 | 5
|
||||
foreign_tbl | 1 | 20 | 5
|
||||
foreign_tbl | 2 | 0 | 5
|
||||
rw_view2 | 2 | 0 | 5
|
||||
(7 rows)
|
||||
|
||||
insert into base_tbl values(1,100,99),(2,100,99);
|
||||
EXPLAIN (VERBOSE, COSTS OFF) delete from rw_view1 where id = 1;
|
||||
QUERY PLAN
|
||||
--------------------------------------------------------------------------------------------------------------------
|
||||
Delete on public.foreign_tbl
|
||||
-> Foreign Scan on public.foreign_tbl
|
||||
Output: foreign_tbl.ctid, foreign_tbl.tableoid
|
||||
Node ID: 1
|
||||
Remote SQL: SELECT ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 1))
|
||||
|
||||
FDW remote plans:
|
||||
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 1))
|
||||
Seq Scan on public.base_tbl
|
||||
Output: ctid, tableoid
|
||||
Filter: ((base_tbl.a < base_tbl.b) AND (base_tbl.id = 1))
|
||||
|
||||
(12 rows)
|
||||
|
||||
delete from rw_view1 where id = 1;
|
||||
EXPLAIN (VERBOSE, COSTS OFF) delete from rw_view2 where id = 2;
|
||||
QUERY PLAN
|
||||
--------------------------------------------------------------------------------------------------------------------
|
||||
Delete on public.foreign_tbl
|
||||
-> Foreign Scan on public.foreign_tbl
|
||||
Output: foreign_tbl.ctid, foreign_tbl.tableoid
|
||||
Node ID: 1
|
||||
Remote SQL: SELECT ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 2))
|
||||
|
||||
FDW remote plans:
|
||||
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 2))
|
||||
Seq Scan on public.base_tbl
|
||||
Output: ctid, tableoid
|
||||
Filter: ((base_tbl.a < base_tbl.b) AND (base_tbl.id = 2))
|
||||
|
||||
(12 rows)
|
||||
|
||||
delete from rw_view2 where id = 2;
|
||||
select * from checkdata();
|
||||
tbname | id | a | b
|
||||
-------------+----+-----+----
|
||||
base_tbl | 1 | 10 | 5
|
||||
base_tbl | 1 | 20 | 5
|
||||
base_tbl | 1 | 100 | 99
|
||||
base_tbl | 2 | 100 | 99
|
||||
foreign_tbl | 1 | 10 | 5
|
||||
foreign_tbl | 1 | 20 | 5
|
||||
foreign_tbl | 1 | 100 | 99
|
||||
foreign_tbl | 2 | 100 | 99
|
||||
(8 rows)
|
||||
|
||||
delete from base_tbl;
|
||||
-- with trigger
|
||||
CREATE FUNCTION row_before_insupd_trigfunc() RETURNS trigger AS $$BEGIN NEW.a := NEW.a + 10; RETURN NEW; END$$ LANGUAGE plpgsql;
|
||||
CREATE TRIGGER row_before_insupd_trigger BEFORE INSERT OR UPDATE ON base_tbl FOR EACH ROW EXECUTE PROCEDURE row_before_insupd_trigfunc();
|
||||
CREATE FOREIGN TABLE foreign_tbl (a int, b int)
|
||||
SERVER loopback OPTIONS (table_name 'base_tbl');
|
||||
-- CREATE VIEW rw_view AS SELECT * FROM foreign_tbl
|
||||
-- WHERE a < b WITH CHECK OPTION;
|
||||
-- \d+ rw_view
|
||||
DROP FOREIGN TABLE foreign_tbl CASCADE;
|
||||
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view1 VALUES (1, 0, 5); -- should success
|
||||
QUERY PLAN
|
||||
------------------------------
|
||||
Insert on public.foreign_tbl
|
||||
-> Result
|
||||
Output: 1, 0, 5
|
||||
(3 rows)
|
||||
|
||||
INSERT INTO rw_view1 VALUES (1, 0, 5);
|
||||
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view1 VALUES (1, 0, 16); -- should success
|
||||
QUERY PLAN
|
||||
------------------------------
|
||||
Insert on public.foreign_tbl
|
||||
-> Result
|
||||
Output: 1, 0, 16
|
||||
(3 rows)
|
||||
|
||||
INSERT INTO rw_view1 VALUES (1, 0, 16);
|
||||
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view2 VALUES (2, 0, 5); -- should failed
|
||||
QUERY PLAN
|
||||
------------------------------
|
||||
Insert on public.foreign_tbl
|
||||
-> Result
|
||||
Output: 2, 0, 5
|
||||
(3 rows)
|
||||
|
||||
INSERT INTO rw_view2 VALUES (2, 0, 5);
|
||||
ERROR: new row violates WITH CHECK OPTION for view "rw_view2"
|
||||
DETAIL: Failing row contains (2, 10, 5).
|
||||
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view2 VALUES (2, 0, 16); -- should success
|
||||
QUERY PLAN
|
||||
------------------------------
|
||||
Insert on public.foreign_tbl
|
||||
-> Result
|
||||
Output: 2, 0, 16
|
||||
(3 rows)
|
||||
|
||||
INSERT INTO rw_view2 VALUES (2, 0, 16);
|
||||
select * from checkdata();
|
||||
tbname | id | a | b
|
||||
-------------+----+----+----
|
||||
base_tbl | 1 | 10 | 5
|
||||
base_tbl | 1 | 10 | 16
|
||||
base_tbl | 2 | 10 | 16
|
||||
foreign_tbl | 1 | 10 | 5
|
||||
foreign_tbl | 1 | 10 | 16
|
||||
foreign_tbl | 2 | 10 | 16
|
||||
rw_view1 | 1 | 10 | 16
|
||||
rw_view2 | 2 | 10 | 16
|
||||
(8 rows)
|
||||
|
||||
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view1 SET a = a - 1 where id = 1;
|
||||
QUERY PLAN
|
||||
------------------------------------------------------------------------------------------------------------------------------
|
||||
Update on public.foreign_tbl
|
||||
-> Foreign Scan on public.foreign_tbl
|
||||
Output: foreign_tbl.id, (foreign_tbl.a - 1), foreign_tbl.b, foreign_tbl.ctid, foreign_tbl.tableoid
|
||||
Node ID: 1
|
||||
Remote SQL: SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 1))
|
||||
|
||||
FDW remote plans:
|
||||
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 1))
|
||||
Seq Scan on public.base_tbl
|
||||
Output: id, a, b, ctid, tableoid
|
||||
Filter: ((base_tbl.a < base_tbl.b) AND (base_tbl.id = 1))
|
||||
|
||||
(12 rows)
|
||||
|
||||
UPDATE rw_view1 SET a = a - 1 where id = 1;
|
||||
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view1 SET a = a + 1 where id = 1;
|
||||
QUERY PLAN
|
||||
------------------------------------------------------------------------------------------------------------------------------
|
||||
Update on public.foreign_tbl
|
||||
-> Foreign Scan on public.foreign_tbl
|
||||
Output: foreign_tbl.id, (foreign_tbl.a + 1), foreign_tbl.b, foreign_tbl.ctid, foreign_tbl.tableoid
|
||||
Node ID: 1
|
||||
Remote SQL: SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 1))
|
||||
|
||||
FDW remote plans:
|
||||
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 1))
|
||||
Seq Scan on public.base_tbl
|
||||
Output: id, a, b, ctid, tableoid
|
||||
Filter: ((base_tbl.a < base_tbl.b) AND (base_tbl.id = 1))
|
||||
|
||||
(12 rows)
|
||||
|
||||
UPDATE rw_view1 SET a = a + 1 where id = 1;
|
||||
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view2 SET a = a - 10 where id = 2;
|
||||
QUERY PLAN
|
||||
------------------------------------------------------------------------------------------------------------------------------
|
||||
Update on public.foreign_tbl
|
||||
-> Foreign Scan on public.foreign_tbl
|
||||
Output: foreign_tbl.id, (foreign_tbl.a - 10), foreign_tbl.b, foreign_tbl.ctid, foreign_tbl.tableoid
|
||||
Node ID: 1
|
||||
Remote SQL: SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 2))
|
||||
|
||||
FDW remote plans:
|
||||
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 2))
|
||||
Seq Scan on public.base_tbl
|
||||
Output: id, a, b, ctid, tableoid
|
||||
Filter: ((base_tbl.a < base_tbl.b) AND (base_tbl.id = 2))
|
||||
|
||||
(12 rows)
|
||||
|
||||
UPDATE rw_view2 SET a = a - 10 where id = 2;
|
||||
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view2 SET a = a + 10 where id = 2;
|
||||
QUERY PLAN
|
||||
------------------------------------------------------------------------------------------------------------------------------
|
||||
Update on public.foreign_tbl
|
||||
-> Foreign Scan on public.foreign_tbl
|
||||
Output: foreign_tbl.id, (foreign_tbl.a + 10), foreign_tbl.b, foreign_tbl.ctid, foreign_tbl.tableoid
|
||||
Node ID: 1
|
||||
Remote SQL: SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 2))
|
||||
|
||||
FDW remote plans:
|
||||
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 2))
|
||||
Seq Scan on public.base_tbl
|
||||
Output: id, a, b, ctid, tableoid
|
||||
Filter: ((base_tbl.a < base_tbl.b) AND (base_tbl.id = 2))
|
||||
|
||||
(12 rows)
|
||||
|
||||
UPDATE rw_view2 SET a = a + 10 where id = 2;
|
||||
ERROR: new row violates WITH CHECK OPTION for view "rw_view2"
|
||||
DETAIL: Failing row contains (2, 30, 16).
|
||||
select * from checkdata();
|
||||
tbname | id | a | b
|
||||
-------------+----+----+----
|
||||
base_tbl | 1 | 10 | 5
|
||||
base_tbl | 1 | 19 | 16
|
||||
base_tbl | 2 | 10 | 16
|
||||
foreign_tbl | 1 | 10 | 5
|
||||
foreign_tbl | 1 | 19 | 16
|
||||
foreign_tbl | 2 | 10 | 16
|
||||
rw_view2 | 2 | 10 | 16
|
||||
(7 rows)
|
||||
|
||||
DROP TRIGGER row_before_insupd_trigger ON base_tbl;
|
||||
DROP TABLE base_tbl;
|
||||
DROP FUNCTION row_before_insupd_trigfunc;
|
||||
DROP FUNCTION checkdata;
|
||||
DROP VIEW rw_view1 cascade;
|
||||
DROP VIEW rw_view2 cascade;
|
||||
DROP FOREIGN TABLE foreign_tbl CASCADE;
|
||||
DROP TABLE base_tbl CASCADE;
|
||||
-- ======================================================================================================================================
|
||||
-- TEST-MODULE: test serial columns (ie, sequence-based defaults)
|
||||
-- --------------------------------------
|
||||
|
|
|
|||
|
|
@ -1365,20 +1365,20 @@ SELECT * FROM ft1 t1 WHERE t1.c1 === t1.c2 order by t1.c2 limit 1;
|
|||
|
||||
-- case when expr
|
||||
explain (verbose, costs off) select * from ft1 where case c1 when 1 then 0 end = 0;
|
||||
QUERY PLAN
|
||||
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
QUERY PLAN
|
||||
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
Foreign Scan on public.ft1
|
||||
Output: c1, c2, c3, c4, c5, c6, c7, c8
|
||||
Node ID: 1
|
||||
Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" WHERE (((CASE "C 1" WHEN 1 THEN 0::numeric ELSE NULL::numeric END) = 0::numeric))
|
||||
Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" WHERE (((CASE "C 1" WHEN 1 THEN 0 ELSE NULL::integer END) = 0))
|
||||
|
||||
FDW remote plans:
|
||||
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" WHERE (((CASE "C 1" WHEN 1 THEN 0::numeric ELSE NULL::numeric END) = 0::numeric))
|
||||
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" WHERE (((CASE "C 1" WHEN 1 THEN 0 ELSE NULL::integer END) = 0))
|
||||
Row Adapter
|
||||
Output: "C 1", c2, c3, c4, c5, c6, c7, c8
|
||||
-> CStore Scan on "S 1"."T 1"
|
||||
Output: "C 1", c2, c3, c4, c5, c6, c7, c8
|
||||
Filter: (CASE "T 1"."C 1" WHEN 1 THEN 0::numeric ELSE NULL::numeric END = 0::numeric)
|
||||
Filter: (CASE "T 1"."C 1" WHEN 1 THEN 0 ELSE NULL::integer END = 0)
|
||||
|
||||
(13 rows)
|
||||
|
||||
|
|
@ -7089,25 +7089,166 @@ CONTEXT: Remote SQL command: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8, ctid, ta
|
|||
ALTER FOREIGN TABLE ft1 DROP CONSTRAINT ft1_c2negative;
|
||||
ERROR: constraint "ft1_c2negative" of relation "ft1" does not exist
|
||||
-- ======================================================================================================================================
|
||||
-- TEST-MODULE: WITH CHECK OPTION constraints
|
||||
-- TEST-MODULE: IUD VIEW and WITH CHECK OPTION constraints
|
||||
-- --------------------------------------
|
||||
-- openGauss not support WITH CHECK OPTION, so this test module
|
||||
-- is unuseful.
|
||||
-- ======================================================================================================================================
|
||||
CREATE FUNCTION row_before_insupd_trigfunc() RETURNS trigger AS $$BEGIN NEW.a := NEW.a + 10; RETURN NEW; END$$ LANGUAGE plpgsql;
|
||||
CREATE TABLE base_tbl (a int, b int) with (orientation=column);
|
||||
CREATE TABLE base_tbl (id int, a int, b int) with (orientation=column);
|
||||
ALTER TABLE base_tbl SET (autovacuum_enabled = 'false');
|
||||
CREATE FOREIGN TABLE foreign_tbl (id int, a int, b int) SERVER loopback OPTIONS (table_name 'base_tbl');
|
||||
CREATE VIEW rw_view1 AS SELECT * FROM foreign_tbl WHERE a < b and id = 1;
|
||||
CREATE VIEW rw_view2 AS SELECT * FROM foreign_tbl WHERE a < b and id = 2 WITH CHECK OPTION;
|
||||
\d+ rw_view1
|
||||
View "public.rw_view1"
|
||||
Column | Type | Modifiers | Storage | Description
|
||||
--------+---------+-----------+---------+-------------
|
||||
id | integer | | plain |
|
||||
a | integer | | plain |
|
||||
b | integer | | plain |
|
||||
View definition:
|
||||
SELECT *
|
||||
FROM foreign_tbl
|
||||
WHERE foreign_tbl.a < foreign_tbl.b AND foreign_tbl.id = 1;
|
||||
|
||||
\d+ rw_view2
|
||||
View "public.rw_view2"
|
||||
Column | Type | Modifiers | Storage | Description
|
||||
--------+---------+-----------+---------+-------------
|
||||
id | integer | | plain |
|
||||
a | integer | | plain |
|
||||
b | integer | | plain |
|
||||
View definition:
|
||||
SELECT *
|
||||
FROM foreign_tbl
|
||||
WHERE foreign_tbl.a < foreign_tbl.b AND foreign_tbl.id = 2;
|
||||
Options: check_option=cascaded
|
||||
|
||||
CREATE OR REPLACE FUNCTION checkdata(out tbname text, out id int, out a int, out b int) RETURNS SETOF record as $$
|
||||
select * from (
|
||||
(select 'rw_view1', * from rw_view1 where id = 1) union all
|
||||
(select 'rw_view2', * from rw_view2 where id = 2) union all
|
||||
(select 'base_tbl', * from base_tbl) union all
|
||||
(select 'foreign_tbl', * from foreign_tbl)
|
||||
) data(tbname, id, a, b)
|
||||
order by 1,2,3,4;
|
||||
$$ language sql;
|
||||
-- simple case
|
||||
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view1 VALUES (1, 0, 5); -- should success
|
||||
QUERY PLAN
|
||||
------------------------------
|
||||
Insert on public.foreign_tbl
|
||||
-> Result
|
||||
Output: 1, 0, 5
|
||||
(3 rows)
|
||||
|
||||
INSERT INTO rw_view1 VALUES (1, 0, 5);
|
||||
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view1 VALUES (1, 10, 5); -- should success
|
||||
QUERY PLAN
|
||||
------------------------------
|
||||
Insert on public.foreign_tbl
|
||||
-> Result
|
||||
Output: 1, 10, 5
|
||||
(3 rows)
|
||||
|
||||
INSERT INTO rw_view1 VALUES (1, 10, 5);
|
||||
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view2 VALUES (2, 0, 5); -- should failed
|
||||
QUERY PLAN
|
||||
------------------------------
|
||||
Insert on public.foreign_tbl
|
||||
-> Result
|
||||
Output: 2, 0, 5
|
||||
(3 rows)
|
||||
|
||||
INSERT INTO rw_view2 VALUES (2, 0, 5);
|
||||
ERROR: Un-support feature
|
||||
DETAIL: column stored relation doesn't support INSERT returning
|
||||
CONTEXT: Remote SQL command: INSERT INTO public.base_tbl(id, a, b) VALUES ($1, $2, $3) RETURNING id, a, b
|
||||
select * from checkdata();
|
||||
tbname | id | a | b
|
||||
-------------+----+----+---
|
||||
base_tbl | 1 | 0 | 5
|
||||
base_tbl | 1 | 10 | 5
|
||||
foreign_tbl | 1 | 0 | 5
|
||||
foreign_tbl | 1 | 10 | 5
|
||||
rw_view1 | 1 | 0 | 5
|
||||
(5 rows)
|
||||
|
||||
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view1 SET a = a + 20 where id = 1; -- should success
|
||||
QUERY PLAN
|
||||
------------------------------------------------------------------------------------------------------------------------------
|
||||
Update on public.foreign_tbl
|
||||
-> Foreign Scan on public.foreign_tbl
|
||||
Output: foreign_tbl.id, (foreign_tbl.a + 20), foreign_tbl.b, foreign_tbl.ctid, foreign_tbl.tableoid
|
||||
Node ID: 1
|
||||
Remote SQL: SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 1))
|
||||
|
||||
FDW remote plans:
|
||||
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 1))
|
||||
Row Adapter
|
||||
Output: id, a, b, ctid, tableoid
|
||||
-> CStore Scan on public.base_tbl
|
||||
Output: id, a, b, ctid, tableoid
|
||||
Filter: ((base_tbl.a < base_tbl.b) AND (base_tbl.id = 1))
|
||||
|
||||
(14 rows)
|
||||
|
||||
UPDATE rw_view1 SET a = a + 20 where id = 1;
|
||||
select * from checkdata();
|
||||
tbname | id | a | b
|
||||
-------------+----+----+---
|
||||
base_tbl | 1 | 10 | 5
|
||||
base_tbl | 1 | 20 | 5
|
||||
foreign_tbl | 1 | 10 | 5
|
||||
foreign_tbl | 1 | 20 | 5
|
||||
(4 rows)
|
||||
|
||||
insert into base_tbl values(1,100,99),(2,100,99);
|
||||
EXPLAIN (VERBOSE, COSTS OFF) delete from rw_view1 where id = 1;
|
||||
QUERY PLAN
|
||||
--------------------------------------------------------------------------------------------------------------------
|
||||
Delete on public.foreign_tbl
|
||||
-> Foreign Scan on public.foreign_tbl
|
||||
Output: foreign_tbl.ctid, foreign_tbl.tableoid
|
||||
Node ID: 1
|
||||
Remote SQL: SELECT ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 1))
|
||||
|
||||
FDW remote plans:
|
||||
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 1))
|
||||
Row Adapter
|
||||
Output: ctid, tableoid
|
||||
-> CStore Scan on public.base_tbl
|
||||
Output: ctid, tableoid
|
||||
Filter: ((base_tbl.a < base_tbl.b) AND (base_tbl.id = 1))
|
||||
|
||||
(14 rows)
|
||||
|
||||
delete from rw_view1 where id = 1;
|
||||
select * from checkdata();
|
||||
tbname | id | a | b
|
||||
-------------+----+-----+----
|
||||
base_tbl | 1 | 10 | 5
|
||||
base_tbl | 1 | 20 | 5
|
||||
base_tbl | 1 | 100 | 99
|
||||
base_tbl | 2 | 100 | 99
|
||||
foreign_tbl | 1 | 10 | 5
|
||||
foreign_tbl | 1 | 20 | 5
|
||||
foreign_tbl | 1 | 100 | 99
|
||||
foreign_tbl | 2 | 100 | 99
|
||||
(8 rows)
|
||||
|
||||
delete from base_tbl;
|
||||
-- with trigger
|
||||
CREATE FUNCTION row_before_insupd_trigfunc() RETURNS trigger AS $$BEGIN NEW.a := NEW.a + 10; RETURN NEW; END$$ LANGUAGE plpgsql;
|
||||
CREATE TRIGGER row_before_insupd_trigger BEFORE INSERT OR UPDATE ON base_tbl FOR EACH ROW EXECUTE PROCEDURE row_before_insupd_trigfunc();
|
||||
ERROR: Only support CREATE TRIGGER on regular row table.
|
||||
CREATE FOREIGN TABLE foreign_tbl (a int, b int)
|
||||
SERVER loopback OPTIONS (table_name 'base_tbl');
|
||||
-- CREATE VIEW rw_view AS SELECT * FROM foreign_tbl
|
||||
-- WHERE a < b WITH CHECK OPTION;
|
||||
-- \d+ rw_view
|
||||
DROP FOREIGN TABLE foreign_tbl CASCADE;
|
||||
-- not support, do nothing
|
||||
DROP TRIGGER row_before_insupd_trigger ON base_tbl;
|
||||
ERROR: trigger "row_before_insupd_trigger" for table "base_tbl" does not exist
|
||||
DROP TABLE base_tbl;
|
||||
DROP FUNCTION row_before_insupd_trigfunc;
|
||||
DROP FUNCTION checkdata;
|
||||
DROP VIEW rw_view1 cascade;
|
||||
DROP VIEW rw_view2 cascade;
|
||||
DROP FOREIGN TABLE foreign_tbl CASCADE;
|
||||
DROP TABLE base_tbl CASCADE;
|
||||
-- ======================================================================================================================================
|
||||
-- TEST-MODULE: test serial columns (ie, sequence-based defaults)
|
||||
-- --------------------------------------
|
||||
|
|
|
|||
|
|
@ -252,12 +252,6 @@ EXPLAIN (COSTS OFF) SELECT * FROM ft6; --err
|
|||
SELECT * FROM ft6;
|
||||
c1 | c2 | c3
|
||||
----+-----+--------
|
||||
12 | 13 | AAA012
|
||||
18 | 19 | AAA018
|
||||
27 | 28 | AAA027
|
||||
39 | 40 | AAA039
|
||||
45 | 46 | AAA045
|
||||
48 | 49 | AAA048
|
||||
3 | 4 | AAA003
|
||||
6 | 7 | AAA006
|
||||
9 | 10 | AAA009
|
||||
|
|
@ -268,12 +262,12 @@ SELECT * FROM ft6;
|
|||
33 | 34 | AAA033
|
||||
36 | 37 | AAA036
|
||||
42 | 43 | AAA042
|
||||
51 | 52 | AAA051
|
||||
63 | 64 | AAA063
|
||||
66 | 67 | AAA066
|
||||
69 | 70 | AAA069
|
||||
75 | 76 | AAA075
|
||||
84 | 85 | AAA084
|
||||
12 | 13 | AAA012
|
||||
18 | 19 | AAA018
|
||||
27 | 28 | AAA027
|
||||
39 | 40 | AAA039
|
||||
45 | 46 | AAA045
|
||||
48 | 49 | AAA048
|
||||
54 | 55 | AAA054
|
||||
57 | 58 | AAA057
|
||||
60 | 61 | AAA060
|
||||
|
|
@ -285,6 +279,12 @@ SELECT * FROM ft6;
|
|||
93 | 94 | AAA093
|
||||
96 | 97 | AAA096
|
||||
99 | 100 | AAA099
|
||||
51 | 52 | AAA051
|
||||
63 | 64 | AAA063
|
||||
66 | 67 | AAA066
|
||||
69 | 70 | AAA069
|
||||
75 | 76 | AAA075
|
||||
84 | 85 | AAA084
|
||||
(33 rows)
|
||||
|
||||
SHOW sql_beta_feature;
|
||||
|
|
@ -313,12 +313,6 @@ EXPLAIN (COSTS OFF) SELECT * FROM ft6; --suc
|
|||
SELECT * FROM ft6;
|
||||
c1 | c2 | c3
|
||||
----+-----+--------
|
||||
12 | 13 | AAA012
|
||||
18 | 19 | AAA018
|
||||
27 | 28 | AAA027
|
||||
39 | 40 | AAA039
|
||||
45 | 46 | AAA045
|
||||
48 | 49 | AAA048
|
||||
3 | 4 | AAA003
|
||||
6 | 7 | AAA006
|
||||
9 | 10 | AAA009
|
||||
|
|
@ -329,12 +323,12 @@ SELECT * FROM ft6;
|
|||
33 | 34 | AAA033
|
||||
36 | 37 | AAA036
|
||||
42 | 43 | AAA042
|
||||
51 | 52 | AAA051
|
||||
63 | 64 | AAA063
|
||||
66 | 67 | AAA066
|
||||
69 | 70 | AAA069
|
||||
75 | 76 | AAA075
|
||||
84 | 85 | AAA084
|
||||
12 | 13 | AAA012
|
||||
18 | 19 | AAA018
|
||||
27 | 28 | AAA027
|
||||
39 | 40 | AAA039
|
||||
45 | 46 | AAA045
|
||||
48 | 49 | AAA048
|
||||
54 | 55 | AAA054
|
||||
57 | 58 | AAA057
|
||||
60 | 61 | AAA060
|
||||
|
|
@ -346,6 +340,12 @@ SELECT * FROM ft6;
|
|||
93 | 94 | AAA093
|
||||
96 | 97 | AAA096
|
||||
99 | 100 | AAA099
|
||||
51 | 52 | AAA051
|
||||
63 | 64 | AAA063
|
||||
66 | 67 | AAA066
|
||||
69 | 70 | AAA069
|
||||
75 | 76 | AAA075
|
||||
84 | 85 | AAA084
|
||||
(33 rows)
|
||||
|
||||
-- ======================================================================================================================================
|
||||
|
|
@ -1931,10 +1931,10 @@ SELECT t1.c1, t1.c2, t2.c1, t2.c2 FROM ft4 t1 LEFT JOIN (SELECT * FROM ft5 WHERE
|
|||
SELECT t1.c1, t1.c2, t2.c1, t2.c2 FROM ft4 t1 LEFT JOIN (SELECT * FROM ft5 WHERE c1 < 10) t2 ON (t1.c1 = t2.c1) WHERE t1.c1 < 10;
|
||||
c1 | c2 | c1 | c2
|
||||
----+----+----+----
|
||||
4 | 5 | |
|
||||
2 | 3 | |
|
||||
6 | 7 | 6 | 7
|
||||
8 | 9 | |
|
||||
4 | 5 | |
|
||||
(4 rows)
|
||||
|
||||
-- clauses within the nullable side are not pulled up, but the top level clause
|
||||
|
|
@ -1980,10 +1980,10 @@ SELECT t1.c1, t1.c2, t2.c1, t2.c2 FROM ft4 t1 LEFT JOIN (SELECT * FROM ft5 WHERE
|
|||
WHERE (t2.c1 < 10 OR t2.c1 IS NULL) AND t1.c1 < 10;
|
||||
c1 | c2 | c1 | c2
|
||||
----+----+----+----
|
||||
4 | 5 | |
|
||||
2 | 3 | |
|
||||
6 | 7 | 6 | 7
|
||||
8 | 9 | |
|
||||
4 | 5 | |
|
||||
(4 rows)
|
||||
|
||||
-- right outer join
|
||||
|
|
@ -2492,7 +2492,7 @@ SELECT t1.c1, ss.a, ss.b FROM (SELECT c1 FROM "S 1"."T 3" WHERE c1 = 50) t1 INNE
|
|||
-> Partitioned Index Scan using t3_pkey on "S 1"."T 3"
|
||||
Output: "T 3".c1, "T 3".ctid, "T 3".tableoid
|
||||
Index Cond: ("T 3".c1 = 50)
|
||||
Selected Partitions: 1
|
||||
Selected Partitions: 2
|
||||
-> Hash Full Join
|
||||
Output: ft4.c1, ft4.*, ft5.c1, ft5.*
|
||||
Hash Cond: (ft4.c1 = ft5.c1)
|
||||
|
|
@ -4058,9 +4058,9 @@ SELECT ft4.c1, q.* FROM ft4 LEFT JOIN (SELECT 13, ft1.c1, ft2.c1 FROM ft1 RIGHT
|
|||
SELECT ft4.c1, q.* FROM ft4 LEFT JOIN (SELECT 13, ft1.c1, ft2.c1 FROM ft1 RIGHT JOIN ft2 ON (ft1.c1 = ft2.c1) WHERE ft1.c1 = 12) q(a, b, c) ON (ft4.c1 = q.b) WHERE ft4.c1 BETWEEN 10 AND 15;
|
||||
c1 | a | b | c
|
||||
----+----+----+----
|
||||
12 | 13 | 12 | 12
|
||||
10 | | |
|
||||
14 | | |
|
||||
12 | 13 | 12 | 12
|
||||
(3 rows)
|
||||
|
||||
-- join with nullable side with some columns with null values
|
||||
|
|
@ -5547,7 +5547,6 @@ create operator public.>^ (
|
|||
procedure = int4gt
|
||||
);
|
||||
create operator family my_op_family using btree;
|
||||
ERROR: user defined operator is not yet supported.
|
||||
create function my_op_cmp(a int, b int) returns int as
|
||||
$$begin return btint4cmp(a, b); end $$ language plpgsql;
|
||||
create operator class my_op_class for type int using btree family my_op_family as
|
||||
|
|
@ -5555,23 +5554,35 @@ create operator class my_op_class for type int using btree family my_op_family a
|
|||
operator 3 public.=^,
|
||||
operator 5 public.>^,
|
||||
function 1 my_op_cmp(int, int);
|
||||
ERROR: operator family "my_op_family" does not exist for access method "btree"
|
||||
-- NOTICES:
|
||||
-- openGauss not support create operator class. remove the case. If you want to restore the test case later, refer to README in the file header.
|
||||
-- This will not be pushed as sort operator is now removed from the extension.
|
||||
explain (verbose, costs off)
|
||||
select array_agg(c1 order by c1 using operator(public.<^)) from ft2 where c2 = 6 and c1 < 100 group by c2;
|
||||
ERROR: operator <^ is not a valid ordering operator
|
||||
LINE 2: select array_agg(c1 order by c1 using operator(public.<^)) f...
|
||||
^
|
||||
HINT: Ordering operators must be "<" or ">" members of btree operator families.
|
||||
CONTEXT: referenced column: array_agg
|
||||
QUERY PLAN
|
||||
-----------------------------------------------------------------------------------------------------------------
|
||||
GroupAggregate
|
||||
Output: array_agg(c1 ORDER BY c1 USING <^ NULLS LAST), c2
|
||||
Group By Key: ft2.c2
|
||||
-> Foreign Scan on public.ft2
|
||||
Output: c2, c1
|
||||
Node ID: 1
|
||||
Remote SQL: SELECT "C 1", c2 FROM "S 1"."T 1" WHERE (("C 1" < 100)) AND ((c2 = 6))
|
||||
|
||||
FDW remote plans:
|
||||
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT "C 1", c2 FROM "S 1"."T 1" WHERE (("C 1" < 100)) AND ((c2 = 6))
|
||||
Partitioned Index Scan using t1_pkey on "S 1"."T 1"
|
||||
Output: "C 1", c2
|
||||
Index Cond: ("T 1"."C 1" < 100)
|
||||
Filter: ("T 1".c2 = 6)
|
||||
Selected Partitions: 1
|
||||
|
||||
(16 rows)
|
||||
|
||||
-- Cleanup
|
||||
drop operator class my_op_class using btree;
|
||||
ERROR: operator class "my_op_class" does not exist for access method "btree"
|
||||
drop function my_op_cmp(a int, b int);
|
||||
drop operator family my_op_family using btree;
|
||||
ERROR: operator family "my_op_family" does not exist for access method "btree"
|
||||
drop operator public.>^(int, int);
|
||||
drop operator public.=^(int, int);
|
||||
drop operator public.<^(int, int);
|
||||
|
|
@ -6788,6 +6799,459 @@ SELECT f_test(100);
|
|||
|
||||
DROP FUNCTION f_test(int);
|
||||
-- ======================================================================================================================================
|
||||
-- TEST-MODULE: IUD VIEW and WITH CHECK OPTION constraints
|
||||
-- --------------------------------------
|
||||
-- ======================================================================================================================================
|
||||
CREATE TABLE base_tbl (id int, a int, b int)
|
||||
partition by range(a) (partition a1 values less than(100), partition a2 values less than(200));
|
||||
ALTER TABLE base_tbl SET (autovacuum_enabled = 'false');
|
||||
CREATE FOREIGN TABLE foreign_tbl (id int, a int, b int) SERVER loopback OPTIONS (table_name 'base_tbl');
|
||||
CREATE VIEW rw_view1 AS SELECT * FROM foreign_tbl WHERE a < b and id = 1;
|
||||
CREATE VIEW rw_view2 AS SELECT * FROM foreign_tbl WHERE a < b and id = 2 WITH CHECK OPTION;
|
||||
\d+ rw_view1
|
||||
View "public.rw_view1"
|
||||
Column | Type | Modifiers | Storage | Description
|
||||
--------+---------+-----------+---------+-------------
|
||||
id | integer | | plain |
|
||||
a | integer | | plain |
|
||||
b | integer | | plain |
|
||||
View definition:
|
||||
SELECT *
|
||||
FROM foreign_tbl
|
||||
WHERE foreign_tbl.a < foreign_tbl.b AND foreign_tbl.id = 1;
|
||||
|
||||
\d+ rw_view2
|
||||
View "public.rw_view2"
|
||||
Column | Type | Modifiers | Storage | Description
|
||||
--------+---------+-----------+---------+-------------
|
||||
id | integer | | plain |
|
||||
a | integer | | plain |
|
||||
b | integer | | plain |
|
||||
View definition:
|
||||
SELECT *
|
||||
FROM foreign_tbl
|
||||
WHERE foreign_tbl.a < foreign_tbl.b AND foreign_tbl.id = 2;
|
||||
Options: check_option=cascaded
|
||||
|
||||
CREATE OR REPLACE FUNCTION checkdata(out tbname text, out id int, out a int, out b int) RETURNS SETOF record as $$
|
||||
select * from (
|
||||
(select 'rw_view1', * from rw_view1 where id = 1) union all
|
||||
(select 'rw_view2', * from rw_view2 where id = 2) union all
|
||||
(select 'base_tbl p1', * from base_tbl) union all
|
||||
(select 'base_tbl p2', * from base_tbl) union all
|
||||
(select 'foreign_tbl', * from foreign_tbl)
|
||||
) data(tbname, id, a, b)
|
||||
order by 1,2,3,4;
|
||||
$$ language sql;
|
||||
-- simple case
|
||||
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view1 VALUES (1, 0, 5); -- should success
|
||||
QUERY PLAN
|
||||
------------------------------
|
||||
Insert on public.foreign_tbl
|
||||
-> Result
|
||||
Output: 1, 0, 5
|
||||
(3 rows)
|
||||
|
||||
INSERT INTO rw_view1 VALUES (1, 0, 5);
|
||||
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view1 VALUES (1, 100, 5); -- should success
|
||||
QUERY PLAN
|
||||
------------------------------
|
||||
Insert on public.foreign_tbl
|
||||
-> Result
|
||||
Output: 1, 100, 5
|
||||
(3 rows)
|
||||
|
||||
INSERT INTO rw_view1 VALUES (1, 100, 5);
|
||||
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view1 VALUES (1, 1000, 5000); -- should failed
|
||||
QUERY PLAN
|
||||
-------------------------------
|
||||
Insert on public.foreign_tbl
|
||||
-> Result
|
||||
Output: 1, 1000, 5000
|
||||
(3 rows)
|
||||
|
||||
INSERT INTO rw_view1 VALUES (1, 1000, 5000);
|
||||
ERROR: inserted partition key does not map to any table partition
|
||||
CONTEXT: Remote SQL command: INSERT INTO public.base_tbl(id, a, b) VALUES ($1, $2, $3)
|
||||
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view2 VALUES (2, 0, 5); -- should success
|
||||
QUERY PLAN
|
||||
------------------------------
|
||||
Insert on public.foreign_tbl
|
||||
-> Result
|
||||
Output: 2, 0, 5
|
||||
(3 rows)
|
||||
|
||||
INSERT INTO rw_view2 VALUES (2, 0, 5);
|
||||
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view2 VALUES (2, 100, 5); -- should failed
|
||||
QUERY PLAN
|
||||
------------------------------
|
||||
Insert on public.foreign_tbl
|
||||
-> Result
|
||||
Output: 2, 100, 5
|
||||
(3 rows)
|
||||
|
||||
INSERT INTO rw_view2 VALUES (2, 100, 5);
|
||||
ERROR: new row violates WITH CHECK OPTION for view "rw_view2"
|
||||
DETAIL: Failing row contains (2, 100, 5).
|
||||
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view2 VALUES (2, 1000, 5000); -- should failed
|
||||
QUERY PLAN
|
||||
-------------------------------
|
||||
Insert on public.foreign_tbl
|
||||
-> Result
|
||||
Output: 2, 1000, 5000
|
||||
(3 rows)
|
||||
|
||||
INSERT INTO rw_view2 VALUES (2, 1000, 5000);
|
||||
ERROR: inserted partition key does not map to any table partition
|
||||
CONTEXT: Remote SQL command: INSERT INTO public.base_tbl(id, a, b) VALUES ($1, $2, $3) RETURNING id, a, b
|
||||
select * from checkdata();
|
||||
tbname | id | a | b
|
||||
-------------+----+-----+---
|
||||
base_tbl p1 | 1 | 0 | 5
|
||||
base_tbl p1 | 1 | 100 | 5
|
||||
base_tbl p1 | 2 | 0 | 5
|
||||
base_tbl p2 | 1 | 0 | 5
|
||||
base_tbl p2 | 1 | 100 | 5
|
||||
base_tbl p2 | 2 | 0 | 5
|
||||
foreign_tbl | 1 | 0 | 5
|
||||
foreign_tbl | 1 | 100 | 5
|
||||
foreign_tbl | 2 | 0 | 5
|
||||
rw_view1 | 1 | 0 | 5
|
||||
rw_view2 | 2 | 0 | 5
|
||||
(11 rows)
|
||||
|
||||
delete from base_tbl;
|
||||
insert into base_tbl values(1, 65, 100), (2, 85, 100); -- in and cross partition update
|
||||
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view1 SET a = a + 20 where id = 1; -- should success
|
||||
QUERY PLAN
|
||||
------------------------------------------------------------------------------------------------------------------------------
|
||||
Update on public.foreign_tbl
|
||||
-> Foreign Scan on public.foreign_tbl
|
||||
Output: foreign_tbl.id, (foreign_tbl.a + 20), foreign_tbl.b, foreign_tbl.ctid, foreign_tbl.tableoid
|
||||
Node ID: 1
|
||||
Remote SQL: SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 1))
|
||||
|
||||
FDW remote plans:
|
||||
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 1))
|
||||
Partition Iterator
|
||||
Output: id, a, b, ctid, tableoid
|
||||
Iterations: 2
|
||||
-> Partitioned Seq Scan on public.base_tbl
|
||||
Output: id, a, b, ctid, tableoid
|
||||
Filter: ((base_tbl.a < base_tbl.b) AND (base_tbl.id = 1))
|
||||
Selected Partitions: 1..2
|
||||
|
||||
(16 rows)
|
||||
|
||||
UPDATE rw_view1 SET a = a + 10 where id = 1;
|
||||
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view1 SET a = a + 20 where id = 1; -- should success
|
||||
QUERY PLAN
|
||||
------------------------------------------------------------------------------------------------------------------------------
|
||||
Update on public.foreign_tbl
|
||||
-> Foreign Scan on public.foreign_tbl
|
||||
Output: foreign_tbl.id, (foreign_tbl.a + 20), foreign_tbl.b, foreign_tbl.ctid, foreign_tbl.tableoid
|
||||
Node ID: 1
|
||||
Remote SQL: SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 1))
|
||||
|
||||
FDW remote plans:
|
||||
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 1))
|
||||
Partition Iterator
|
||||
Output: id, a, b, ctid, tableoid
|
||||
Iterations: 2
|
||||
-> Partitioned Seq Scan on public.base_tbl
|
||||
Output: id, a, b, ctid, tableoid
|
||||
Filter: ((base_tbl.a < base_tbl.b) AND (base_tbl.id = 1))
|
||||
Selected Partitions: 1..2
|
||||
|
||||
(16 rows)
|
||||
|
||||
UPDATE rw_view1 SET a = a + 10 where id = 1;
|
||||
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view2 SET a = a + 20 where id = 2; -- should failed
|
||||
QUERY PLAN
|
||||
------------------------------------------------------------------------------------------------------------------------------
|
||||
Update on public.foreign_tbl
|
||||
-> Foreign Scan on public.foreign_tbl
|
||||
Output: foreign_tbl.id, (foreign_tbl.a + 20), foreign_tbl.b, foreign_tbl.ctid, foreign_tbl.tableoid
|
||||
Node ID: 1
|
||||
Remote SQL: SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 2))
|
||||
|
||||
FDW remote plans:
|
||||
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 2))
|
||||
Partition Iterator
|
||||
Output: id, a, b, ctid, tableoid
|
||||
Iterations: 2
|
||||
-> Partitioned Seq Scan on public.base_tbl
|
||||
Output: id, a, b, ctid, tableoid
|
||||
Filter: ((base_tbl.a < base_tbl.b) AND (base_tbl.id = 2))
|
||||
Selected Partitions: 1..2
|
||||
|
||||
(16 rows)
|
||||
|
||||
UPDATE rw_view2 SET a = a + 20 where id = 2;
|
||||
ERROR: new row violates WITH CHECK OPTION for view "rw_view2"
|
||||
DETAIL: Failing row contains (2, 105, 100).
|
||||
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view2 SET a = a + 20, b = 200 where id = 2; -- should success
|
||||
QUERY PLAN
|
||||
---------------------------------------------------------------------------------------------------------------------------
|
||||
Update on public.foreign_tbl
|
||||
-> Foreign Scan on public.foreign_tbl
|
||||
Output: foreign_tbl.id, (foreign_tbl.a + 20), 200, foreign_tbl.ctid, foreign_tbl.tableoid
|
||||
Node ID: 1
|
||||
Remote SQL: SELECT id, a, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 2))
|
||||
|
||||
FDW remote plans:
|
||||
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT id, a, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 2))
|
||||
Partition Iterator
|
||||
Output: id, a, ctid, tableoid
|
||||
Iterations: 2
|
||||
-> Partitioned Seq Scan on public.base_tbl
|
||||
Output: id, a, ctid, tableoid
|
||||
Filter: ((base_tbl.a < base_tbl.b) AND (base_tbl.id = 2))
|
||||
Selected Partitions: 1..2
|
||||
|
||||
(16 rows)
|
||||
|
||||
UPDATE rw_view2 SET a = a + 20, b = 200 where id = 2;
|
||||
select * from checkdata();
|
||||
tbname | id | a | b
|
||||
-------------+----+-----+-----
|
||||
base_tbl p1 | 1 | 85 | 100
|
||||
base_tbl p1 | 2 | 105 | 200
|
||||
base_tbl p2 | 1 | 85 | 100
|
||||
base_tbl p2 | 2 | 105 | 200
|
||||
foreign_tbl | 1 | 85 | 100
|
||||
foreign_tbl | 2 | 105 | 200
|
||||
rw_view1 | 1 | 85 | 100
|
||||
rw_view2 | 2 | 105 | 200
|
||||
(8 rows)
|
||||
|
||||
delete from base_tbl;
|
||||
insert into base_tbl values(1, 100, 99),(2, 100, 99);
|
||||
EXPLAIN (VERBOSE, COSTS OFF) delete from rw_view1 where id = 1;
|
||||
QUERY PLAN
|
||||
--------------------------------------------------------------------------------------------------------------------
|
||||
Delete on public.foreign_tbl
|
||||
-> Foreign Scan on public.foreign_tbl
|
||||
Output: foreign_tbl.ctid, foreign_tbl.tableoid
|
||||
Node ID: 1
|
||||
Remote SQL: SELECT ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 1))
|
||||
|
||||
FDW remote plans:
|
||||
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 1))
|
||||
Partition Iterator
|
||||
Output: ctid, tableoid
|
||||
Iterations: 2
|
||||
-> Partitioned Seq Scan on public.base_tbl
|
||||
Output: ctid, tableoid
|
||||
Filter: ((base_tbl.a < base_tbl.b) AND (base_tbl.id = 1))
|
||||
Selected Partitions: 1..2
|
||||
|
||||
(16 rows)
|
||||
|
||||
delete from rw_view1 where id = 1;
|
||||
EXPLAIN (VERBOSE, COSTS OFF) delete from rw_view2 where id = 2;
|
||||
QUERY PLAN
|
||||
--------------------------------------------------------------------------------------------------------------------
|
||||
Delete on public.foreign_tbl
|
||||
-> Foreign Scan on public.foreign_tbl
|
||||
Output: foreign_tbl.ctid, foreign_tbl.tableoid
|
||||
Node ID: 1
|
||||
Remote SQL: SELECT ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 2))
|
||||
|
||||
FDW remote plans:
|
||||
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 2))
|
||||
Partition Iterator
|
||||
Output: ctid, tableoid
|
||||
Iterations: 2
|
||||
-> Partitioned Seq Scan on public.base_tbl
|
||||
Output: ctid, tableoid
|
||||
Filter: ((base_tbl.a < base_tbl.b) AND (base_tbl.id = 2))
|
||||
Selected Partitions: 1..2
|
||||
|
||||
(16 rows)
|
||||
|
||||
delete from rw_view2 where id = 2;
|
||||
select * from checkdata();
|
||||
tbname | id | a | b
|
||||
-------------+----+-----+----
|
||||
base_tbl p1 | 1 | 100 | 99
|
||||
base_tbl p1 | 2 | 100 | 99
|
||||
base_tbl p2 | 1 | 100 | 99
|
||||
base_tbl p2 | 2 | 100 | 99
|
||||
foreign_tbl | 1 | 100 | 99
|
||||
foreign_tbl | 2 | 100 | 99
|
||||
(6 rows)
|
||||
|
||||
delete from base_tbl;
|
||||
-- with trigger
|
||||
CREATE FUNCTION row_before_insupd_trigfunc() RETURNS trigger AS $$BEGIN NEW.a := NEW.a + 10; RETURN NEW; END$$ LANGUAGE plpgsql;
|
||||
CREATE TRIGGER row_before_insupd_trigger BEFORE INSERT OR UPDATE ON base_tbl FOR EACH ROW EXECUTE PROCEDURE row_before_insupd_trigfunc();
|
||||
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view1 VALUES (1, 0, 5); -- should success
|
||||
QUERY PLAN
|
||||
------------------------------
|
||||
Insert on public.foreign_tbl
|
||||
-> Result
|
||||
Output: 1, 0, 5
|
||||
(3 rows)
|
||||
|
||||
INSERT INTO rw_view1 VALUES (1, 0, 5);
|
||||
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view1 VALUES (1, 80, 16); -- should success
|
||||
QUERY PLAN
|
||||
------------------------------
|
||||
Insert on public.foreign_tbl
|
||||
-> Result
|
||||
Output: 1, 80, 16
|
||||
(3 rows)
|
||||
|
||||
INSERT INTO rw_view1 VALUES (1, 80, 16);
|
||||
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view2 VALUES (2, 0, 5); -- should failed
|
||||
QUERY PLAN
|
||||
------------------------------
|
||||
Insert on public.foreign_tbl
|
||||
-> Result
|
||||
Output: 2, 0, 5
|
||||
(3 rows)
|
||||
|
||||
INSERT INTO rw_view2 VALUES (2, 0, 5);
|
||||
ERROR: new row violates WITH CHECK OPTION for view "rw_view2"
|
||||
DETAIL: Failing row contains (2, 10, 5).
|
||||
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view2 VALUES (2, 0, 16); -- should success
|
||||
QUERY PLAN
|
||||
------------------------------
|
||||
Insert on public.foreign_tbl
|
||||
-> Result
|
||||
Output: 2, 0, 16
|
||||
(3 rows)
|
||||
|
||||
INSERT INTO rw_view2 VALUES (2, 0, 16);
|
||||
select * from checkdata();
|
||||
tbname | id | a | b
|
||||
-------------+----+----+----
|
||||
base_tbl p1 | 1 | 10 | 5
|
||||
base_tbl p1 | 1 | 90 | 16
|
||||
base_tbl p1 | 2 | 10 | 16
|
||||
base_tbl p2 | 1 | 10 | 5
|
||||
base_tbl p2 | 1 | 90 | 16
|
||||
base_tbl p2 | 2 | 10 | 16
|
||||
foreign_tbl | 1 | 10 | 5
|
||||
foreign_tbl | 1 | 90 | 16
|
||||
foreign_tbl | 2 | 10 | 16
|
||||
rw_view2 | 2 | 10 | 16
|
||||
(10 rows)
|
||||
|
||||
delete from base_tbl;
|
||||
insert into base_tbl values(1, 50, 101), (2, 50, 120); -- in and cross partition update
|
||||
-- (1, 60, 101), (2, 60, 120)
|
||||
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view1 SET a = a + 20 where id = 1; -- should success
|
||||
QUERY PLAN
|
||||
------------------------------------------------------------------------------------------------------------------------------
|
||||
Update on public.foreign_tbl
|
||||
-> Foreign Scan on public.foreign_tbl
|
||||
Output: foreign_tbl.id, (foreign_tbl.a + 20), foreign_tbl.b, foreign_tbl.ctid, foreign_tbl.tableoid
|
||||
Node ID: 1
|
||||
Remote SQL: SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 1))
|
||||
|
||||
FDW remote plans:
|
||||
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 1))
|
||||
Partition Iterator
|
||||
Output: id, a, b, ctid, tableoid
|
||||
Iterations: 2
|
||||
-> Partitioned Seq Scan on public.base_tbl
|
||||
Output: id, a, b, ctid, tableoid
|
||||
Filter: ((base_tbl.a < base_tbl.b) AND (base_tbl.id = 1))
|
||||
Selected Partitions: 1..2
|
||||
|
||||
(16 rows)
|
||||
|
||||
UPDATE rw_view1 SET a = a +20 where id = 1;
|
||||
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view1 SET a = a + 20 where id = 1; -- should success
|
||||
QUERY PLAN
|
||||
------------------------------------------------------------------------------------------------------------------------------
|
||||
Update on public.foreign_tbl
|
||||
-> Foreign Scan on public.foreign_tbl
|
||||
Output: foreign_tbl.id, (foreign_tbl.a + 20), foreign_tbl.b, foreign_tbl.ctid, foreign_tbl.tableoid
|
||||
Node ID: 1
|
||||
Remote SQL: SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 1))
|
||||
|
||||
FDW remote plans:
|
||||
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 1))
|
||||
Partition Iterator
|
||||
Output: id, a, b, ctid, tableoid
|
||||
Iterations: 2
|
||||
-> Partitioned Seq Scan on public.base_tbl
|
||||
Output: id, a, b, ctid, tableoid
|
||||
Filter: ((base_tbl.a < base_tbl.b) AND (base_tbl.id = 1))
|
||||
Selected Partitions: 1..2
|
||||
|
||||
(16 rows)
|
||||
|
||||
UPDATE rw_view1 SET a = a +20 where id = 1;
|
||||
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view2 SET a = a + 55 where id = 2; -- should failed
|
||||
QUERY PLAN
|
||||
------------------------------------------------------------------------------------------------------------------------------
|
||||
Update on public.foreign_tbl
|
||||
-> Foreign Scan on public.foreign_tbl
|
||||
Output: foreign_tbl.id, (foreign_tbl.a + 55), foreign_tbl.b, foreign_tbl.ctid, foreign_tbl.tableoid
|
||||
Node ID: 1
|
||||
Remote SQL: SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 2))
|
||||
|
||||
FDW remote plans:
|
||||
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 2))
|
||||
Partition Iterator
|
||||
Output: id, a, b, ctid, tableoid
|
||||
Iterations: 2
|
||||
-> Partitioned Seq Scan on public.base_tbl
|
||||
Output: id, a, b, ctid, tableoid
|
||||
Filter: ((base_tbl.a < base_tbl.b) AND (base_tbl.id = 2))
|
||||
Selected Partitions: 1..2
|
||||
|
||||
(16 rows)
|
||||
|
||||
UPDATE rw_view2 SET a = a + 55 where id = 2;
|
||||
ERROR: new row violates WITH CHECK OPTION for view "rw_view2"
|
||||
DETAIL: Failing row contains (2, 125, 120).
|
||||
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view2 SET a = a + 45 where id = 2; -- should success
|
||||
QUERY PLAN
|
||||
------------------------------------------------------------------------------------------------------------------------------
|
||||
Update on public.foreign_tbl
|
||||
-> Foreign Scan on public.foreign_tbl
|
||||
Output: foreign_tbl.id, (foreign_tbl.a + 45), foreign_tbl.b, foreign_tbl.ctid, foreign_tbl.tableoid
|
||||
Node ID: 1
|
||||
Remote SQL: SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 2))
|
||||
|
||||
FDW remote plans:
|
||||
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 2))
|
||||
Partition Iterator
|
||||
Output: id, a, b, ctid, tableoid
|
||||
Iterations: 2
|
||||
-> Partitioned Seq Scan on public.base_tbl
|
||||
Output: id, a, b, ctid, tableoid
|
||||
Filter: ((base_tbl.a < base_tbl.b) AND (base_tbl.id = 2))
|
||||
Selected Partitions: 1..2
|
||||
|
||||
(16 rows)
|
||||
|
||||
UPDATE rw_view2 SET a = a + 45 where id = 2;
|
||||
select * from checkdata();
|
||||
tbname | id | a | b
|
||||
-------------+----+-----+-----
|
||||
base_tbl p1 | 1 | 120 | 101
|
||||
base_tbl p1 | 2 | 115 | 120
|
||||
base_tbl p2 | 1 | 120 | 101
|
||||
base_tbl p2 | 2 | 115 | 120
|
||||
foreign_tbl | 1 | 120 | 101
|
||||
foreign_tbl | 2 | 115 | 120
|
||||
rw_view2 | 2 | 115 | 120
|
||||
(7 rows)
|
||||
|
||||
DROP TRIGGER row_before_insupd_trigger ON base_tbl;
|
||||
DROP FUNCTION row_before_insupd_trigfunc;
|
||||
DROP FUNCTION checkdata;
|
||||
DROP VIEW rw_view1 cascade;
|
||||
DROP VIEW rw_view2 cascade;
|
||||
DROP FOREIGN TABLE foreign_tbl CASCADE;
|
||||
DROP TABLE base_tbl CASCADE;
|
||||
-- ======================================================================================================================================
|
||||
-- TEST-MODULE: test writable foreign table stuff
|
||||
-- --------------------------------------
|
||||
-- ======================================================================================================================================
|
||||
|
|
@ -9183,12 +9647,6 @@ EXPLAIN (VERBOSE, COSTS OFF)select * from ftx;
|
|||
select * from ftx;
|
||||
c1 | c2 | c3
|
||||
----+-----+--------
|
||||
12 | 13 | AAA012
|
||||
39 | 40 | AAA039
|
||||
48 | 49 | AAA048
|
||||
18 | 19 |
|
||||
27 | 28 |
|
||||
45 | 46 |
|
||||
3 | 4 | AAA003
|
||||
6 | 7 | AAA006
|
||||
15 | 16 | AAA015
|
||||
|
|
@ -9199,12 +9657,12 @@ select * from ftx;
|
|||
42 | 43 | AAA042
|
||||
9 | 10 |
|
||||
36 | 37 |
|
||||
51 | 52 | AAA051
|
||||
66 | 67 | AAA066
|
||||
69 | 70 | AAA069
|
||||
75 | 76 | AAA075
|
||||
84 | 85 | AAA084
|
||||
63 | 64 |
|
||||
12 | 13 | AAA012
|
||||
39 | 40 | AAA039
|
||||
48 | 49 | AAA048
|
||||
18 | 19 |
|
||||
27 | 28 |
|
||||
45 | 46 |
|
||||
57 | 58 | AAA057
|
||||
60 | 61 | AAA060
|
||||
78 | 79 | AAA078
|
||||
|
|
@ -9216,6 +9674,12 @@ select * from ftx;
|
|||
81 | 82 |
|
||||
90 | 91 |
|
||||
99 | 100 |
|
||||
51 | 52 | AAA051
|
||||
66 | 67 | AAA066
|
||||
69 | 70 | AAA069
|
||||
75 | 76 | AAA075
|
||||
84 | 85 | AAA084
|
||||
63 | 64 |
|
||||
(33 rows)
|
||||
|
||||
EXPLAIN (VERBOSE, COSTS OFF)select * from ftx partition(ptb1); --ERR
|
||||
|
|
|
|||
|
|
@ -274,6 +274,7 @@ ForeignPath *create_foreign_join_path(PlannerInfo *root, RelOptInfo *rel, List *
|
|||
|
||||
pathnode->path.pathtype = T_ForeignScan;
|
||||
pathnode->path.parent = rel;
|
||||
pathnode->path.pathtarget = rel->reltarget;
|
||||
pathnode->path.param_info = NULL; /* XXX see above */
|
||||
pathnode->path.rows = rows;
|
||||
pathnode->path.startup_cost = startup_cost;
|
||||
|
|
@ -346,7 +347,7 @@ RelOptInfo *fetch_upper_rel(FDWUpperRelCxt *ufdwCxt, UpperRelationKind kind)
|
|||
upperrel->reloptkind = RELOPT_UPPER_REL;
|
||||
upperrel->relids = NULL;
|
||||
|
||||
upperrel->reltargetlist = NIL;
|
||||
upperrel->reltarget = makeNode(PathTarget);
|
||||
upperrel->pathlist = NIL;
|
||||
upperrel->cheapest_startup_path = NULL;
|
||||
upperrel->cheapest_total_path = NULL;
|
||||
|
|
@ -406,7 +407,7 @@ RelOptInfo *make_upper_rel(FDWUpperRelCxt *ufdwCxt, PgFdwRelationInfo *fpinfo)
|
|||
RelOptInfo *upper_rel = fetch_upper_rel(ufdwCxt, fpinfo->stage);
|
||||
|
||||
/* Set target. */
|
||||
upper_rel->reltargetlist = extract_target_from_tel(ufdwCxt, fpinfo);
|
||||
upper_rel->reltarget->exprs = extract_target_from_tel(ufdwCxt, fpinfo);
|
||||
|
||||
/*
|
||||
* If the input rel belongs to a single FDW, so does the grouped rel.
|
||||
|
|
@ -463,6 +464,7 @@ ForeignPath *create_foreign_upper_path(PlannerInfo *root, RelOptInfo *rel, List
|
|||
|
||||
pathnode->path.pathtype = T_ForeignScan;
|
||||
pathnode->path.parent = rel;
|
||||
pathnode->path.pathtarget = rel->reltarget;
|
||||
pathnode->path.param_info = NULL;
|
||||
pathnode->path.rows = rows;
|
||||
pathnode->path.startup_cost = startup_cost;
|
||||
|
|
|
|||
|
|
@ -420,7 +420,7 @@ static void postgresGetForeignRelSize(PlannerInfo *root, RelOptInfo *baserel, Oi
|
|||
* columns used in them. Doesn't seem worth detecting that case though.)
|
||||
*/
|
||||
fpinfo->attrs_used = NULL;
|
||||
pull_varattnos((Node *)baserel->reltargetlist, baserel->relid, &fpinfo->attrs_used);
|
||||
pull_varattnos((Node *)baserel->reltarget->exprs, baserel->relid, &fpinfo->attrs_used);
|
||||
foreach (lc, fpinfo->local_conds) {
|
||||
RestrictInfo *rinfo = (RestrictInfo *)lfirst(lc);
|
||||
|
||||
|
|
@ -463,7 +463,7 @@ static void postgresGetForeignRelSize(PlannerInfo *root, RelOptInfo *baserel, Oi
|
|||
|
||||
/* Report estimated baserel size to planner. */
|
||||
baserel->rows = fpinfo->rows;
|
||||
baserel->width = fpinfo->width;
|
||||
baserel->reltarget->width = fpinfo->width;
|
||||
} else {
|
||||
/*
|
||||
* If the foreign table has never been ANALYZEd, it will have relpages
|
||||
|
|
@ -476,7 +476,7 @@ static void postgresGetForeignRelSize(PlannerInfo *root, RelOptInfo *baserel, Oi
|
|||
*/
|
||||
if (baserel->pages == 0 && baserel->tuples == 0) {
|
||||
baserel->pages = 10;
|
||||
baserel->tuples = (double)(10 * BLCKSZ) / (baserel->width + sizeof(HeapTupleHeaderData));
|
||||
baserel->tuples = (double)(10 * BLCKSZ) / (baserel->reltarget->width + sizeof(HeapTupleHeaderData));
|
||||
}
|
||||
|
||||
/* Estimate baserel size as best we can with local statistics. */
|
||||
|
|
@ -1300,6 +1300,7 @@ static List *postgresPlanForeignModify(PlannerInfo *root, ModifyTable *plan, Ind
|
|||
RangeTblEntry *rte = planner_rt_fetch(resultRelation, root);
|
||||
StringInfoData sql;
|
||||
List *targetAttrs = NIL;
|
||||
List *withCheckOptionList = NIL;
|
||||
List *returningList = NIL;
|
||||
List *retrieved_attrs = NIL;
|
||||
|
||||
|
|
@ -1327,7 +1328,7 @@ static List *postgresPlanForeignModify(PlannerInfo *root, ModifyTable *plan, Ind
|
|||
int attnum;
|
||||
|
||||
for (attnum = 1; attnum <= tupdesc->natts; attnum++) {
|
||||
Form_pg_attribute attr = tupdesc->attrs[attnum - 1];
|
||||
Form_pg_attribute attr = &tupdesc->attrs[attnum - 1];
|
||||
|
||||
if (!attr->attisdropped) {
|
||||
targetAttrs = lappend_int(targetAttrs, attnum);
|
||||
|
|
@ -1347,6 +1348,13 @@ static List *postgresPlanForeignModify(PlannerInfo *root, ModifyTable *plan, Ind
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Extract the relevant WITH CHECK OPTION list if any.
|
||||
*/
|
||||
if (plan->withCheckOptionLists) {
|
||||
withCheckOptionList = (List*)list_nth(plan->withCheckOptionLists, subplan_index);
|
||||
}
|
||||
|
||||
/*
|
||||
* Extract the relevant RETURNING list if any.
|
||||
*/
|
||||
|
|
@ -1359,10 +1367,12 @@ static List *postgresPlanForeignModify(PlannerInfo *root, ModifyTable *plan, Ind
|
|||
*/
|
||||
switch (operation) {
|
||||
case CMD_INSERT:
|
||||
deparseInsertSql(&sql, rte, resultRelation, rel, targetAttrs, returningList, &retrieved_attrs);
|
||||
deparseInsertSql(&sql, rte, resultRelation, rel, targetAttrs, withCheckOptionList, returningList,
|
||||
&retrieved_attrs);
|
||||
break;
|
||||
case CMD_UPDATE:
|
||||
deparseUpdateSql(&sql, rte, resultRelation, rel, targetAttrs, returningList, &retrieved_attrs);
|
||||
deparseUpdateSql(&sql, rte, resultRelation, rel, targetAttrs, withCheckOptionList, returningList,
|
||||
&retrieved_attrs);
|
||||
break;
|
||||
case CMD_DELETE:
|
||||
deparseDeleteSql(&sql, rte, resultRelation, rel, returningList, &retrieved_attrs);
|
||||
|
|
@ -1492,7 +1502,7 @@ static PgFdwModifyState *createForeignModify(EState *estate, RangeTblEntry *rte,
|
|||
/* Set up for remaining transmittable parameters */
|
||||
foreach (lc, fmstate->target_attrs) {
|
||||
int attnum = lfirst_int(lc);
|
||||
Form_pg_attribute attr = tupdesc->attrs[attnum - 1];
|
||||
Form_pg_attribute attr = &tupdesc->attrs[attnum - 1];
|
||||
|
||||
Assert(!attr->attisdropped);
|
||||
|
||||
|
|
@ -1529,13 +1539,13 @@ static TupleTableSlot *postgresExecForeignInsert(EState *estate, ResultRelInfo *
|
|||
initStringInfo(&sql);
|
||||
/* We transmit all columns that are defined in the foreign table. */
|
||||
for (int attnum = 1; attnum <= tupdesc->natts; attnum++) {
|
||||
Form_pg_attribute attr = tupdesc->attrs[attnum - 1];
|
||||
Form_pg_attribute attr = &tupdesc->attrs[attnum - 1];
|
||||
|
||||
if (!attr->attisdropped) {
|
||||
targetAttrs = lappend_int(targetAttrs, attnum);
|
||||
}
|
||||
}
|
||||
deparseInsertSql(&sql, rte, resultRelation, rel, targetAttrs, NULL, &retrieved_attrs);
|
||||
deparseInsertSql(&sql, rte, resultRelation, rel, targetAttrs, NULL, NULL, &retrieved_attrs);
|
||||
|
||||
fmstate = createForeignModify(estate, rte, resultRelInfo, CMD_INSERT, NULL, sql.data, targetAttrs,
|
||||
retrieved_attrs != NIL, retrieved_attrs);
|
||||
|
|
@ -2098,7 +2108,7 @@ static void estimate_path_cost_size(PlannerInfo *root, RelOptInfo *foreignrel, L
|
|||
|
||||
/* Use rows/width estimates made by the core code. */
|
||||
rows = foreignrel->rows;
|
||||
width = foreignrel->width;
|
||||
width = foreignrel->reltarget->width;
|
||||
|
||||
/* For join we expect inner and outer relations set */
|
||||
Assert(fpinfo->innerrel && fpinfo->outerrel);
|
||||
|
|
@ -2189,7 +2199,7 @@ static void estimate_path_cost_size(PlannerInfo *root, RelOptInfo *foreignrel, L
|
|||
/* Collect statistics about aggregates for estimating costs. */
|
||||
MemSet(&aggcosts, 0, sizeof(AggClauseCosts));
|
||||
if (root->parse->hasAggs) {
|
||||
count_agg_clauses(root, (Node*)foreignrel->reltargetlist, &aggcosts);
|
||||
count_agg_clauses(root, (Node*)foreignrel->reltarget->exprs, &aggcosts);
|
||||
count_agg_clauses(root, root->parse->havingQual, &aggcosts);
|
||||
}
|
||||
|
||||
|
|
@ -2216,7 +2226,7 @@ static void estimate_path_cost_size(PlannerInfo *root, RelOptInfo *foreignrel, L
|
|||
}
|
||||
|
||||
/* Use width estimate made by the core code. */
|
||||
width = foreignrel->width;
|
||||
width = foreignrel->reltarget->width;
|
||||
|
||||
/* -----
|
||||
* Startup cost includes:
|
||||
|
|
@ -2259,7 +2269,7 @@ static void estimate_path_cost_size(PlannerInfo *root, RelOptInfo *foreignrel, L
|
|||
|
||||
/* Use rows/width estimates made by set_baserel_size_estimates. */
|
||||
rows = foreignrel->rows;
|
||||
width = foreignrel->width;
|
||||
width = foreignrel->reltarget->width;
|
||||
|
||||
/*
|
||||
* Back into an estimate of the number of retrieved rows. Just in
|
||||
|
|
@ -3953,7 +3963,7 @@ static void postgresGetForeignJoinPaths(PlannerInfo *root, RelOptInfo *joinrel,
|
|||
estimate_path_cost_size(root, joinrel, NIL, NIL, NULL, &rows, &width, &startup_cost, &total_cost);
|
||||
/* Now update this information in the joinrel */
|
||||
joinrel->rows = rows;
|
||||
joinrel->width = width;
|
||||
joinrel->reltarget->width = width;
|
||||
fpinfo->rows = rows;
|
||||
fpinfo->width = width;
|
||||
fpinfo->startup_cost = startup_cost;
|
||||
|
|
@ -4218,7 +4228,7 @@ static void init_upperrel_paths_context(FDWUpperRelCxt* ufdwCxt, Plan* mainPlan)
|
|||
fpinfo->stage = UPPERREL_INIT;
|
||||
|
||||
/* the reltargetlist may bave been evaluted, we shoule adept it. */
|
||||
ufdwCxt->currentRel->reltargetlist = extract_target_from_tel(ufdwCxt, fpinfo);
|
||||
ufdwCxt->currentRel->reltarget->exprs = extract_target_from_tel(ufdwCxt, fpinfo);
|
||||
|
||||
ufdwCxt->state = FDW_UPPER_REL_INIT;
|
||||
}
|
||||
|
|
@ -4388,7 +4398,7 @@ static void add_foreign_grouping_paths(PlannerInfo *root, RelOptInfo *input_rel,
|
|||
fpinfo->total_cost = total_cost;
|
||||
|
||||
/* Create and add foreign path to the grouping relation. */
|
||||
grouppath = create_foreign_upper_path(root, grouped_rel, grouped_rel->reltargetlist, rows, startup_cost, total_cost,
|
||||
grouppath = create_foreign_upper_path(root, grouped_rel, grouped_rel->reltarget->exprs, rows, startup_cost, total_cost,
|
||||
NIL, /* no pathkeys */
|
||||
NULL, NIL); /* no fdw_private */
|
||||
|
||||
|
|
@ -4491,7 +4501,7 @@ static void add_foreign_ordered_paths(PlannerInfo *root, RelOptInfo *input_rel,
|
|||
|
||||
/* Construct PgFdwPathExtraData */
|
||||
fpextra = (PgFdwPathExtraData *)palloc0(sizeof(PgFdwPathExtraData));
|
||||
fpextra->target = ordered_rel->reltargetlist;
|
||||
fpextra->target = ordered_rel->reltarget->exprs;
|
||||
fpextra->has_final_sort = true;
|
||||
|
||||
/* Estimate the costs of performing the final sort remotely */
|
||||
|
|
@ -4505,7 +4515,7 @@ static void add_foreign_ordered_paths(PlannerInfo *root, RelOptInfo *input_rel,
|
|||
fdw_private = list_make2(makeInteger(1), makeInteger(0));
|
||||
|
||||
/* Create foreign ordering path */
|
||||
ordered_path = create_foreign_upper_path(root, input_rel, ordered_rel->reltargetlist, rows, startup_cost,
|
||||
ordered_path = create_foreign_upper_path(root, input_rel, ordered_rel->reltarget->exprs, rows, startup_cost,
|
||||
total_cost, root->sort_pathkeys, NULL, /* no extra plan */
|
||||
fdw_private);
|
||||
|
||||
|
|
|
|||
|
|
@ -151,9 +151,9 @@ extern void classifyConditions(PlannerInfo *root, RelOptInfo *baserel, List *inp
|
|||
extern bool is_foreign_expr(PlannerInfo *root, RelOptInfo *baserel, Expr *expr);
|
||||
extern bool is_foreign_pathkey(PlannerInfo *root, RelOptInfo *baserel, PathKey *pathkey);
|
||||
extern void deparseInsertSql(StringInfo buf, RangeTblEntry *rte, Index rtindex, Relation rel, List *targetAttrs,
|
||||
List *returningList, List **retrieved_attrs);
|
||||
List *withCheckOptionList, List *returningList, List **retrieved_attrs);
|
||||
extern void deparseUpdateSql(StringInfo buf, RangeTblEntry *rte, Index rtindex, Relation rel, List *targetAttrs,
|
||||
List *returningList, List **retrieved_attrs);
|
||||
List *withCheckOptionList, List *returningList, List **retrieved_attrs);
|
||||
extern void deparseDeleteSql(StringInfo buf, RangeTblEntry *rte, Index rtindex, Relation rel, List *returningList,
|
||||
List **retrieved_attrs);
|
||||
extern void deparseAnalyzeSizeSql(StringInfo buf, Relation rel);
|
||||
|
|
|
|||
|
|
@ -1371,24 +1371,85 @@ UPDATE ft1 SET c2 = c2 + 1 WHERE c1 = 1;
|
|||
ALTER FOREIGN TABLE ft1 DROP CONSTRAINT ft1_c2negative;
|
||||
|
||||
-- ======================================================================================================================================
|
||||
-- TEST-MODULE: WITH CHECK OPTION constraints
|
||||
-- TEST-MODULE: IUD VIEW and WITH CHECK OPTION constraints
|
||||
-- --------------------------------------
|
||||
-- openGauss not support WITH CHECK OPTION, so this test module is unuseful and cannot be fixed, remove it.
|
||||
-- ======================================================================================================================================
|
||||
CREATE FUNCTION row_before_insupd_trigfunc() RETURNS trigger AS $$BEGIN NEW.a := NEW.a + 10; RETURN NEW; END$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE TABLE base_tbl (a int, b int);
|
||||
CREATE TABLE base_tbl (id int, a int, b int);
|
||||
ALTER TABLE base_tbl SET (autovacuum_enabled = 'false');
|
||||
CREATE TRIGGER row_before_insupd_trigger BEFORE INSERT OR UPDATE ON base_tbl FOR EACH ROW EXECUTE PROCEDURE row_before_insupd_trigfunc();
|
||||
CREATE FOREIGN TABLE foreign_tbl (a int, b int)
|
||||
SERVER loopback OPTIONS (table_name 'base_tbl');
|
||||
-- CREATE VIEW rw_view AS SELECT * FROM foreign_tbl
|
||||
-- WHERE a < b WITH CHECK OPTION;
|
||||
-- \d+ rw_view
|
||||
CREATE FOREIGN TABLE foreign_tbl (id int, a int, b int) SERVER loopback OPTIONS (table_name 'base_tbl');
|
||||
CREATE VIEW rw_view1 AS SELECT * FROM foreign_tbl WHERE a < b and id = 1;
|
||||
CREATE VIEW rw_view2 AS SELECT * FROM foreign_tbl WHERE a < b and id = 2 WITH CHECK OPTION;
|
||||
\d+ rw_view1
|
||||
\d+ rw_view2
|
||||
CREATE OR REPLACE FUNCTION checkdata(out tbname text, out id int, out a int, out b int) RETURNS SETOF record as $$
|
||||
select * from (
|
||||
(select 'rw_view1', * from rw_view1 where id = 1) union all
|
||||
(select 'rw_view2', * from rw_view2 where id = 2) union all
|
||||
(select 'base_tbl', * from base_tbl) union all
|
||||
(select 'foreign_tbl', * from foreign_tbl)
|
||||
) data(tbname, id, a, b)
|
||||
order by 1,2,3,4;
|
||||
$$ language sql;
|
||||
|
||||
-- simple case
|
||||
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view1 VALUES (1, 0, 5); -- should success
|
||||
INSERT INTO rw_view1 VALUES (1, 0, 5);
|
||||
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view1 VALUES (1, 10, 5); -- should success
|
||||
INSERT INTO rw_view1 VALUES (1, 10, 5);
|
||||
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view2 VALUES (2, 0, 5); -- should success
|
||||
INSERT INTO rw_view2 VALUES (2, 0, 5);
|
||||
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view2 VALUES (2, 10, 5); -- should failed
|
||||
INSERT INTO rw_view2 VALUES (2, 10, 5);
|
||||
select * from checkdata();
|
||||
|
||||
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view1 SET a = a + 20 where id = 1; -- should success
|
||||
UPDATE rw_view1 SET a = a + 20 where id = 1;
|
||||
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view2 SET a = a + 20 where id = 2; -- should failed
|
||||
UPDATE rw_view2 SET a = a + 20 where id = 2;
|
||||
select * from checkdata();
|
||||
|
||||
insert into base_tbl values(1,100,99),(2,100,99);
|
||||
EXPLAIN (VERBOSE, COSTS OFF) delete from rw_view1 where id = 1;
|
||||
delete from rw_view1 where id = 1;
|
||||
EXPLAIN (VERBOSE, COSTS OFF) delete from rw_view2 where id = 2;
|
||||
delete from rw_view2 where id = 2;
|
||||
select * from checkdata();
|
||||
|
||||
delete from base_tbl;
|
||||
|
||||
-- with trigger
|
||||
CREATE FUNCTION row_before_insupd_trigfunc() RETURNS trigger AS $$BEGIN NEW.a := NEW.a + 10; RETURN NEW; END$$ LANGUAGE plpgsql;
|
||||
CREATE TRIGGER row_before_insupd_trigger BEFORE INSERT OR UPDATE ON base_tbl FOR EACH ROW EXECUTE PROCEDURE row_before_insupd_trigfunc();
|
||||
|
||||
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view1 VALUES (1, 0, 5); -- should success
|
||||
INSERT INTO rw_view1 VALUES (1, 0, 5);
|
||||
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view1 VALUES (1, 0, 16); -- should success
|
||||
INSERT INTO rw_view1 VALUES (1, 0, 16);
|
||||
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view2 VALUES (2, 0, 5); -- should failed
|
||||
INSERT INTO rw_view2 VALUES (2, 0, 5);
|
||||
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view2 VALUES (2, 0, 16); -- should success
|
||||
INSERT INTO rw_view2 VALUES (2, 0, 16);
|
||||
select * from checkdata();
|
||||
|
||||
|
||||
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view1 SET a = a - 1 where id = 1;
|
||||
UPDATE rw_view1 SET a = a - 1 where id = 1;
|
||||
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view1 SET a = a + 1 where id = 1;
|
||||
UPDATE rw_view1 SET a = a + 1 where id = 1;
|
||||
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view2 SET a = a - 10 where id = 2;
|
||||
UPDATE rw_view2 SET a = a - 10 where id = 2;
|
||||
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view2 SET a = a + 10 where id = 2;
|
||||
UPDATE rw_view2 SET a = a + 10 where id = 2;
|
||||
select * from checkdata();
|
||||
|
||||
|
||||
DROP FOREIGN TABLE foreign_tbl CASCADE;
|
||||
DROP TRIGGER row_before_insupd_trigger ON base_tbl;
|
||||
DROP TABLE base_tbl;
|
||||
DROP FUNCTION row_before_insupd_trigfunc;
|
||||
DROP FUNCTION checkdata;
|
||||
DROP VIEW rw_view1 cascade;
|
||||
DROP VIEW rw_view2 cascade;
|
||||
DROP FOREIGN TABLE foreign_tbl CASCADE;
|
||||
DROP TABLE base_tbl CASCADE;
|
||||
|
||||
|
||||
-- ======================================================================================================================================
|
||||
|
|
|
|||
|
|
@ -1008,26 +1008,59 @@ UPDATE ft1 SET c2 = c2 + 1 WHERE c1 = 1;
|
|||
ALTER FOREIGN TABLE ft1 DROP CONSTRAINT ft1_c2negative;
|
||||
|
||||
-- ======================================================================================================================================
|
||||
-- TEST-MODULE: WITH CHECK OPTION constraints
|
||||
-- TEST-MODULE: IUD VIEW and WITH CHECK OPTION constraints
|
||||
-- --------------------------------------
|
||||
-- openGauss not support WITH CHECK OPTION, so this test module
|
||||
-- is unuseful.
|
||||
-- ======================================================================================================================================
|
||||
|
||||
CREATE FUNCTION row_before_insupd_trigfunc() RETURNS trigger AS $$BEGIN NEW.a := NEW.a + 10; RETURN NEW; END$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE TABLE base_tbl (a int, b int) with (orientation=column);
|
||||
CREATE TABLE base_tbl (id int, a int, b int) with (orientation=column);
|
||||
ALTER TABLE base_tbl SET (autovacuum_enabled = 'false');
|
||||
CREATE TRIGGER row_before_insupd_trigger BEFORE INSERT OR UPDATE ON base_tbl FOR EACH ROW EXECUTE PROCEDURE row_before_insupd_trigfunc();
|
||||
CREATE FOREIGN TABLE foreign_tbl (a int, b int)
|
||||
SERVER loopback OPTIONS (table_name 'base_tbl');
|
||||
-- CREATE VIEW rw_view AS SELECT * FROM foreign_tbl
|
||||
-- WHERE a < b WITH CHECK OPTION;
|
||||
-- \d+ rw_view
|
||||
CREATE FOREIGN TABLE foreign_tbl (id int, a int, b int) SERVER loopback OPTIONS (table_name 'base_tbl');
|
||||
CREATE VIEW rw_view1 AS SELECT * FROM foreign_tbl WHERE a < b and id = 1;
|
||||
CREATE VIEW rw_view2 AS SELECT * FROM foreign_tbl WHERE a < b and id = 2 WITH CHECK OPTION;
|
||||
\d+ rw_view1
|
||||
\d+ rw_view2
|
||||
CREATE OR REPLACE FUNCTION checkdata(out tbname text, out id int, out a int, out b int) RETURNS SETOF record as $$
|
||||
select * from (
|
||||
(select 'rw_view1', * from rw_view1 where id = 1) union all
|
||||
(select 'rw_view2', * from rw_view2 where id = 2) union all
|
||||
(select 'base_tbl', * from base_tbl) union all
|
||||
(select 'foreign_tbl', * from foreign_tbl)
|
||||
) data(tbname, id, a, b)
|
||||
order by 1,2,3,4;
|
||||
$$ language sql;
|
||||
|
||||
-- simple case
|
||||
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view1 VALUES (1, 0, 5); -- should success
|
||||
INSERT INTO rw_view1 VALUES (1, 0, 5);
|
||||
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view1 VALUES (1, 10, 5); -- should success
|
||||
INSERT INTO rw_view1 VALUES (1, 10, 5);
|
||||
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view2 VALUES (2, 0, 5); -- should failed
|
||||
INSERT INTO rw_view2 VALUES (2, 0, 5);
|
||||
select * from checkdata();
|
||||
|
||||
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view1 SET a = a + 20 where id = 1; -- should success
|
||||
UPDATE rw_view1 SET a = a + 20 where id = 1;
|
||||
select * from checkdata();
|
||||
|
||||
insert into base_tbl values(1,100,99),(2,100,99);
|
||||
EXPLAIN (VERBOSE, COSTS OFF) delete from rw_view1 where id = 1;
|
||||
delete from rw_view1 where id = 1;
|
||||
select * from checkdata();
|
||||
|
||||
delete from base_tbl;
|
||||
|
||||
-- with trigger
|
||||
CREATE FUNCTION row_before_insupd_trigfunc() RETURNS trigger AS $$BEGIN NEW.a := NEW.a + 10; RETURN NEW; END$$ LANGUAGE plpgsql;
|
||||
CREATE TRIGGER row_before_insupd_trigger BEFORE INSERT OR UPDATE ON base_tbl FOR EACH ROW EXECUTE PROCEDURE row_before_insupd_trigfunc();
|
||||
-- not support, do nothing
|
||||
|
||||
DROP FOREIGN TABLE foreign_tbl CASCADE;
|
||||
DROP TRIGGER row_before_insupd_trigger ON base_tbl;
|
||||
DROP TABLE base_tbl;
|
||||
DROP FUNCTION row_before_insupd_trigfunc;
|
||||
DROP FUNCTION checkdata;
|
||||
DROP VIEW rw_view1 cascade;
|
||||
DROP VIEW rw_view2 cascade;
|
||||
DROP FOREIGN TABLE foreign_tbl CASCADE;
|
||||
DROP TABLE base_tbl CASCADE;
|
||||
|
||||
|
||||
-- ======================================================================================================================================
|
||||
-- TEST-MODULE: test serial columns (ie, sequence-based defaults)
|
||||
|
|
|
|||
|
|
@ -1053,6 +1053,101 @@ $$ LANGUAGE plpgsql;
|
|||
SELECT f_test(100);
|
||||
DROP FUNCTION f_test(int);
|
||||
|
||||
-- ======================================================================================================================================
|
||||
-- TEST-MODULE: IUD VIEW and WITH CHECK OPTION constraints
|
||||
-- --------------------------------------
|
||||
-- ======================================================================================================================================
|
||||
CREATE TABLE base_tbl (id int, a int, b int)
|
||||
partition by range(a) (partition a1 values less than(100), partition a2 values less than(200));
|
||||
ALTER TABLE base_tbl SET (autovacuum_enabled = 'false');
|
||||
CREATE FOREIGN TABLE foreign_tbl (id int, a int, b int) SERVER loopback OPTIONS (table_name 'base_tbl');
|
||||
CREATE VIEW rw_view1 AS SELECT * FROM foreign_tbl WHERE a < b and id = 1;
|
||||
CREATE VIEW rw_view2 AS SELECT * FROM foreign_tbl WHERE a < b and id = 2 WITH CHECK OPTION;
|
||||
\d+ rw_view1
|
||||
\d+ rw_view2
|
||||
CREATE OR REPLACE FUNCTION checkdata(out tbname text, out id int, out a int, out b int) RETURNS SETOF record as $$
|
||||
select * from (
|
||||
(select 'rw_view1', * from rw_view1 where id = 1) union all
|
||||
(select 'rw_view2', * from rw_view2 where id = 2) union all
|
||||
(select 'base_tbl p1', * from base_tbl) union all
|
||||
(select 'base_tbl p2', * from base_tbl) union all
|
||||
(select 'foreign_tbl', * from foreign_tbl)
|
||||
) data(tbname, id, a, b)
|
||||
order by 1,2,3,4;
|
||||
$$ language sql;
|
||||
|
||||
-- simple case
|
||||
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view1 VALUES (1, 0, 5); -- should success
|
||||
INSERT INTO rw_view1 VALUES (1, 0, 5);
|
||||
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view1 VALUES (1, 100, 5); -- should success
|
||||
INSERT INTO rw_view1 VALUES (1, 100, 5);
|
||||
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view1 VALUES (1, 1000, 5000); -- should failed
|
||||
INSERT INTO rw_view1 VALUES (1, 1000, 5000);
|
||||
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view2 VALUES (2, 0, 5); -- should success
|
||||
INSERT INTO rw_view2 VALUES (2, 0, 5);
|
||||
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view2 VALUES (2, 100, 5); -- should failed
|
||||
INSERT INTO rw_view2 VALUES (2, 100, 5);
|
||||
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view2 VALUES (2, 1000, 5000); -- should failed
|
||||
INSERT INTO rw_view2 VALUES (2, 1000, 5000);
|
||||
select * from checkdata();
|
||||
delete from base_tbl;
|
||||
|
||||
insert into base_tbl values(1, 65, 100), (2, 85, 100); -- in and cross partition update
|
||||
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view1 SET a = a + 20 where id = 1; -- should success
|
||||
UPDATE rw_view1 SET a = a + 10 where id = 1;
|
||||
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view1 SET a = a + 20 where id = 1; -- should success
|
||||
UPDATE rw_view1 SET a = a + 10 where id = 1;
|
||||
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view2 SET a = a + 20 where id = 2; -- should failed
|
||||
UPDATE rw_view2 SET a = a + 20 where id = 2;
|
||||
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view2 SET a = a + 20, b = 200 where id = 2; -- should success
|
||||
UPDATE rw_view2 SET a = a + 20, b = 200 where id = 2;
|
||||
select * from checkdata();
|
||||
delete from base_tbl;
|
||||
|
||||
insert into base_tbl values(1, 100, 99),(2, 100, 99);
|
||||
EXPLAIN (VERBOSE, COSTS OFF) delete from rw_view1 where id = 1;
|
||||
delete from rw_view1 where id = 1;
|
||||
EXPLAIN (VERBOSE, COSTS OFF) delete from rw_view2 where id = 2;
|
||||
delete from rw_view2 where id = 2;
|
||||
select * from checkdata();
|
||||
delete from base_tbl;
|
||||
|
||||
-- with trigger
|
||||
CREATE FUNCTION row_before_insupd_trigfunc() RETURNS trigger AS $$BEGIN NEW.a := NEW.a + 10; RETURN NEW; END$$ LANGUAGE plpgsql;
|
||||
CREATE TRIGGER row_before_insupd_trigger BEFORE INSERT OR UPDATE ON base_tbl FOR EACH ROW EXECUTE PROCEDURE row_before_insupd_trigfunc();
|
||||
|
||||
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view1 VALUES (1, 0, 5); -- should success
|
||||
INSERT INTO rw_view1 VALUES (1, 0, 5);
|
||||
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view1 VALUES (1, 80, 16); -- should success
|
||||
INSERT INTO rw_view1 VALUES (1, 80, 16);
|
||||
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view2 VALUES (2, 0, 5); -- should failed
|
||||
INSERT INTO rw_view2 VALUES (2, 0, 5);
|
||||
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view2 VALUES (2, 0, 16); -- should success
|
||||
INSERT INTO rw_view2 VALUES (2, 0, 16);
|
||||
select * from checkdata();
|
||||
delete from base_tbl;
|
||||
|
||||
insert into base_tbl values(1, 50, 101), (2, 50, 120); -- in and cross partition update
|
||||
-- (1, 60, 101), (2, 60, 120)
|
||||
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view1 SET a = a + 20 where id = 1; -- should success
|
||||
UPDATE rw_view1 SET a = a +20 where id = 1;
|
||||
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view1 SET a = a + 20 where id = 1; -- should success
|
||||
UPDATE rw_view1 SET a = a +20 where id = 1;
|
||||
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view2 SET a = a + 55 where id = 2; -- should failed
|
||||
UPDATE rw_view2 SET a = a + 55 where id = 2;
|
||||
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view2 SET a = a + 45 where id = 2; -- should success
|
||||
UPDATE rw_view2 SET a = a + 45 where id = 2;
|
||||
select * from checkdata();
|
||||
|
||||
DROP TRIGGER row_before_insupd_trigger ON base_tbl;
|
||||
DROP FUNCTION row_before_insupd_trigfunc;
|
||||
DROP FUNCTION checkdata;
|
||||
DROP VIEW rw_view1 cascade;
|
||||
DROP VIEW rw_view2 cascade;
|
||||
DROP FOREIGN TABLE foreign_tbl CASCADE;
|
||||
DROP TABLE base_tbl CASCADE;
|
||||
|
||||
|
||||
-- ======================================================================================================================================
|
||||
-- TEST-MODULE: test writable foreign table stuff
|
||||
-- --------------------------------------
|
||||
|
|
|
|||
|
|
@ -515,30 +515,6 @@ void set_result_set_function(const PolicyLabelItem &func)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* check exchange partition list contains masked table.
|
||||
* For given AlterTableCmd list, check whether ordinary
|
||||
* tables have bound masking policies.
|
||||
*/
|
||||
static bool exchange_partition_with_masked_table(List *cmds)
|
||||
{
|
||||
if (cmds == NIL) {
|
||||
return false;
|
||||
}
|
||||
ListCell *lc = NULL;
|
||||
foreach (lc, cmds) {
|
||||
AlterTableCmd *cmd = (AlterTableCmd*)lfirst(lc);
|
||||
if (cmd->subtype == AT_ExchangePartition && cmd->exchange_with_rel != NULL) {
|
||||
Oid relid = RangeVarGetRelid(cmd->exchange_with_rel, NoLock, true);
|
||||
if (is_masked_relation(relid)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static void gsaudit_next_PostParseAnalyze_hook(ParseState *pstate, Query *query)
|
||||
{
|
||||
/* do nothing when enable_security_policy is off */
|
||||
|
|
@ -652,9 +628,24 @@ static void gsaudit_next_PostParseAnalyze_hook(ParseState *pstate, Query *query)
|
|||
/* For ALTER TABLE EXCHANGE, will not allowed if the ordinary table(it's columns) has masking policy.*/
|
||||
if (query->utilityStmt != NULL && nodeTag(query->utilityStmt) == T_AlterTableStmt) {
|
||||
AlterTableStmt *alter_table = (AlterTableStmt *)(query->utilityStmt);
|
||||
if (exchange_partition_with_masked_table(alter_table->cmds)) {
|
||||
ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||
errmsg("ALTER TABLE EXCHANGE can not execute with masked ordinary table.")));
|
||||
Oid relid = RangeVarGetRelid(alter_table->relation, NoLock, true);
|
||||
|
||||
ListCell *lc = NULL;
|
||||
foreach (lc, alter_table->cmds) {
|
||||
AlterTableCmd *cmd = (AlterTableCmd *)lfirst(lc);
|
||||
if (cmd->subtype == AT_ExchangePartition) {
|
||||
Assert(PointerIsValid(cmd->exchange_with_rel));
|
||||
if (is_masked_relation(relid)) {
|
||||
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("ALTER TABLE EXCHANGE can not execute with masked partition table.")));
|
||||
}
|
||||
|
||||
Oid ordTableOid = RangeVarGetRelid(cmd->exchange_with_rel, NoLock, true);
|
||||
if (is_masked_relation(ordTableOid)) {
|
||||
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("ALTER TABLE EXCHANGE can not execute with masked ordinary table.")));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -814,19 +805,19 @@ static void light_unified_audit_executor(const Query *query)
|
|||
access_audit_policy_run(query->rtable, query->commandType);
|
||||
}
|
||||
|
||||
static void gsaudit_ProcessUtility_hook(Node *parsetree, const char *queryString, ParamListInfoData *params,
|
||||
bool isTopLevel, DestReceiver *dest, bool sentToRemote, char *completionTag, bool isCTAS = false)
|
||||
static void gsaudit_ProcessUtility_hook(processutility_context* processutility_cxt,
|
||||
DestReceiver *dest, bool sentToRemote, char *completionTag, ProcessUtilityContext context,bool isCTAS = false)
|
||||
{
|
||||
/* do nothing when enable_security_policy is off */
|
||||
if (!u_sess->attr.attr_security.Enable_Security_Policy || !IsConnFromApp() ||
|
||||
u_sess->proc_cxt.IsInnerMaintenanceTools || IsConnFromCoord() ||
|
||||
!is_audit_policy_exist_load_policy_info()) {
|
||||
if (next_ProcessUtility_hook) {
|
||||
next_ProcessUtility_hook(parsetree, queryString, params, isTopLevel, dest, sentToRemote, completionTag,
|
||||
false);
|
||||
next_ProcessUtility_hook(processutility_cxt, dest, sentToRemote, completionTag,
|
||||
context, false);
|
||||
} else {
|
||||
standard_ProcessUtility(parsetree, queryString, params, isTopLevel, dest, sentToRemote, completionTag,
|
||||
false);
|
||||
standard_ProcessUtility(processutility_cxt, dest, sentToRemote, completionTag,
|
||||
context, false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
@ -840,6 +831,7 @@ static void gsaudit_ProcessUtility_hook(Node *parsetree, const char *queryString
|
|||
checkSecurityPolicyFilter_hook(filter_item, &security_policy_ids);
|
||||
}
|
||||
RenameMap renamed_objects;
|
||||
Node* parsetree = processutility_cxt->parse_tree;
|
||||
if (parsetree != NULL) {
|
||||
switch (nodeTag(parsetree)) {
|
||||
case T_PlannedStmt: {
|
||||
|
|
@ -1618,11 +1610,11 @@ static void gsaudit_ProcessUtility_hook(Node *parsetree, const char *queryString
|
|||
PG_TRY();
|
||||
{
|
||||
if (next_ProcessUtility_hook) {
|
||||
next_ProcessUtility_hook(parsetree, queryString, params, isTopLevel, dest, sentToRemote, completionTag,
|
||||
false);
|
||||
next_ProcessUtility_hook(processutility_cxt, dest, sentToRemote, completionTag,
|
||||
context, false);
|
||||
} else {
|
||||
standard_ProcessUtility(parsetree, queryString, params, isTopLevel, dest, sentToRemote, completionTag,
|
||||
false);
|
||||
standard_ProcessUtility(processutility_cxt, dest, sentToRemote, completionTag,
|
||||
context, false);
|
||||
}
|
||||
flush_access_logs(AUDIT_OK);
|
||||
send_mng_events(AUDIT_OK);
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@ static void sepgsql_executor_start(QueryDesc* queryDesc, int eflags)
|
|||
* It tries to rough-grained control on utility commands; some of them can
|
||||
* break whole of the things if nefarious user would use.
|
||||
*/
|
||||
static void sepgsql_utility_command(Node* parsetree, const char* queryString, ParamListInfo params, bool isTopLevel,
|
||||
static void sepgsql_utility_command(processutility_context* processutility_cxt,
|
||||
DestReceiver* dest,
|
||||
#ifdef PGXC
|
||||
bool sentToRemote,
|
||||
|
|
@ -251,6 +251,7 @@ static void sepgsql_utility_command(Node* parsetree, const char* queryString, Pa
|
|||
{
|
||||
sepgsql_context_info_t saved_context_info = sepgsql_context_info;
|
||||
ListCell* cell = NULL;
|
||||
Node* parsetree = processutility_cxt->parse_tree;
|
||||
|
||||
PG_TRY();
|
||||
{
|
||||
|
|
@ -300,20 +301,14 @@ static void sepgsql_utility_command(Node* parsetree, const char* queryString, Pa
|
|||
}
|
||||
|
||||
if (next_ProcessUtility_hook)
|
||||
(*next_ProcessUtility_hook)(parsetree,
|
||||
queryString,
|
||||
params,
|
||||
isTopLevel,
|
||||
(*next_ProcessUtility_hook)(processutility_cxt,
|
||||
dest,
|
||||
#ifdef PGXC
|
||||
sentToRemote,
|
||||
#endif
|
||||
completionTag);
|
||||
else
|
||||
standard_ProcessUtility(parsetree,
|
||||
queryString,
|
||||
params,
|
||||
isTopLevel,
|
||||
standard_ProcessUtility(processutility_cxt,
|
||||
dest,
|
||||
#ifdef PGXC
|
||||
sentToRemote,
|
||||
|
|
|
|||
|
|
@ -312,7 +312,7 @@ Datum /* have to return HeapTuple to Executor */
|
|||
snprintf(sql, sizeof(sql), "INSERT INTO %s VALUES (", relname);
|
||||
for (i = 1; i <= natts; i++) {
|
||||
ctypes[i - 1] = SPI_gettypeid(tupdesc, i);
|
||||
if (!(tupdesc->attrs[i - 1]->attisdropped)) /* skip dropped columns */
|
||||
if (!(tupdesc->attrs[i - 1].attisdropped)) /* skip dropped columns */
|
||||
{
|
||||
snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), "%c$%d", separ, i);
|
||||
separ = ',';
|
||||
|
|
|
|||
|
|
@ -286,7 +286,7 @@ static void print_literal(StringInfo s, Oid typid, char* outputstr)
|
|||
/*
|
||||
* Decode tuple into stringinfo.
|
||||
*/
|
||||
static void TupleToStringinfo(StringInfo s, TupleDesc tupdesc, HeapTuple tuple, bool skip_nulls)
|
||||
static void TupleToStringinfo(StringInfo s, TupleDesc tupdesc, HeapTuple tuple)
|
||||
{
|
||||
Assert(tuple != NULL);
|
||||
if ((tuple->tupTableType == HEAP_TUPLE) && (HEAP_TUPLE_IS_COMPRESSED(tuple->t_data) ||
|
||||
|
|
@ -302,7 +302,7 @@ static void TupleToStringinfo(StringInfo s, TupleDesc tupdesc, HeapTuple tuple,
|
|||
Oid typoutput = 0; /* output function */
|
||||
Datum origval = 0; /* possibly toasted Datum */
|
||||
|
||||
Form_pg_attribute attr = tupdesc->attrs[natt]; /* the attribute itself */
|
||||
Form_pg_attribute attr = &tupdesc->attrs[natt]; /* the attribute itself */
|
||||
|
||||
if (attr->attisdropped || attr->attnum < 0) {
|
||||
continue;
|
||||
|
|
@ -315,10 +315,6 @@ static void TupleToStringinfo(StringInfo s, TupleDesc tupdesc, HeapTuple tuple,
|
|||
origval = uheap_getattr((UHeapTuple)tuple, natt + 1, tupdesc, &isnull);
|
||||
}
|
||||
|
||||
if (skip_nulls && isnull) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* query output function */
|
||||
Oid typid = attr->atttypid; /* type of current attribute */
|
||||
getTypeOutputInfo(typid, &typoutput, &typisvarlena);
|
||||
|
|
@ -343,7 +339,7 @@ static void TupleToStringinfo(StringInfo s, TupleDesc tupdesc, HeapTuple tuple,
|
|||
* Decode tuple into stringinfo.
|
||||
* This function is used for UPDATE or DELETE statements.
|
||||
*/
|
||||
static void TupleToStringinfoUpd(StringInfo s, TupleDesc tupdesc, HeapTuple tuple, bool skip_nulls)
|
||||
static void TupleToStringinfoUpd(Relation relation, StringInfo s, TupleDesc tupdesc, HeapTuple tuple)
|
||||
{
|
||||
if ((tuple->tupTableType == HEAP_TUPLE) && (HEAP_TUPLE_IS_COMPRESSED(tuple->t_data) ||
|
||||
(int)HeapTupleHeaderGetNatts(tuple->t_data, tupdesc) > tupdesc->natts)) {
|
||||
|
|
@ -358,9 +354,9 @@ static void TupleToStringinfoUpd(StringInfo s, TupleDesc tupdesc, HeapTuple tupl
|
|||
bool isnull = false; /* column is null? */
|
||||
bool typisvarlena = false;
|
||||
|
||||
Form_pg_attribute attr = tupdesc->attrs[natt]; /* the attribute itself */
|
||||
Form_pg_attribute attr = &tupdesc->attrs[natt]; /* the attribute itself */
|
||||
|
||||
if (attr->attisdropped || attr->attnum < 0) {
|
||||
if (attr->attisdropped || attr->attnum < 0 || !IsRelationReplidentKey(relation, attr->attnum)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -371,10 +367,6 @@ static void TupleToStringinfoUpd(StringInfo s, TupleDesc tupdesc, HeapTuple tupl
|
|||
origval = uheap_getattr((UHeapTuple)tuple, natt + 1, tupdesc, &isnull);
|
||||
}
|
||||
|
||||
if (isnull && skip_nulls) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isFirstAtt) {
|
||||
appendStringInfoString(s, " and ");
|
||||
} else {
|
||||
|
|
@ -403,31 +395,32 @@ static void TupleToStringinfoUpd(StringInfo s, TupleDesc tupdesc, HeapTuple tupl
|
|||
* Callback for handle decoded tuple.
|
||||
* Additional info will be added if the tuple is found null.
|
||||
*/
|
||||
static void TupleHandler(StringInfo s, TupleDesc tupdesc, ReorderBufferChange* change, bool isHeap, bool isNewTuple)
|
||||
static void TupleHandler(Relation relation, StringInfo s, TupleDesc tupdesc, ReorderBufferChange* change,
|
||||
bool isHeap, bool isNewTuple)
|
||||
{
|
||||
if (isHeap && isNewTuple) {
|
||||
if (change->data.tp.newtuple == NULL) {
|
||||
appendStringInfoString(s, " (no-tuple-data)");
|
||||
} else {
|
||||
TupleToStringinfo(s, tupdesc, &change->data.tp.newtuple->tuple, false);
|
||||
TupleToStringinfo(s, tupdesc, &change->data.tp.newtuple->tuple);
|
||||
}
|
||||
} else if (isHeap && !isNewTuple) {
|
||||
if (change->data.tp.oldtuple == NULL) {
|
||||
appendStringInfoString(s, " (no-tuple-data)");
|
||||
} else {
|
||||
TupleToStringinfoUpd(s, tupdesc, &change->data.tp.oldtuple->tuple, true);
|
||||
TupleToStringinfoUpd(relation, s, tupdesc, &change->data.tp.oldtuple->tuple);
|
||||
}
|
||||
} else if (!isHeap && isNewTuple) {
|
||||
if (change->data.utp.newtuple == NULL) {
|
||||
appendStringInfoString(s, " (no-tuple-data)");
|
||||
} else {
|
||||
TupleToStringinfo(s, tupdesc, (HeapTuple)(&change->data.utp.newtuple->tuple), false);
|
||||
TupleToStringinfo(s, tupdesc, (HeapTuple)(&change->data.utp.newtuple->tuple));
|
||||
}
|
||||
} else {
|
||||
if (change->data.utp.oldtuple == NULL) {
|
||||
appendStringInfoString(s, " (no-tuple-data)");
|
||||
} else {
|
||||
TupleToStringinfoUpd(s, tupdesc, (HeapTuple)(&change->data.utp.oldtuple->tuple), true);
|
||||
TupleToStringinfoUpd(relation, s, tupdesc, (HeapTuple)(&change->data.utp.oldtuple->tuple));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -472,7 +465,7 @@ static void pg_decode_change(
|
|||
isHeap = false;
|
||||
}
|
||||
appendStringInfoString(ctx->out, " values ");
|
||||
TupleHandler(ctx->out, tupdesc, change, isHeap, true);
|
||||
TupleHandler(relation, ctx->out, tupdesc, change, isHeap, true);
|
||||
break;
|
||||
case REORDER_BUFFER_CHANGE_UPDATE:
|
||||
case REORDER_BUFFER_CHANGE_UUPDATE:
|
||||
|
|
@ -483,12 +476,12 @@ static void pg_decode_change(
|
|||
isHeap = false;
|
||||
}
|
||||
appendStringInfoString(ctx->out, " where ");
|
||||
TupleHandler(ctx->out, tupdesc, change, isHeap, false);
|
||||
TupleHandler(relation, ctx->out, tupdesc, change, isHeap, false);
|
||||
appendStringInfoChar(ctx->out, ';');
|
||||
appendStringInfoString(ctx->out, "insert into ");
|
||||
appendStringInfoString(ctx->out, quote_qualified_identifier(schema, table));
|
||||
appendStringInfoString(ctx->out, " values ");
|
||||
TupleHandler(ctx->out, tupdesc, change, isHeap, true);
|
||||
TupleHandler(relation, ctx->out, tupdesc, change, isHeap, true);
|
||||
|
||||
break;
|
||||
|
||||
|
|
@ -502,7 +495,7 @@ static void pg_decode_change(
|
|||
}
|
||||
appendStringInfoString(ctx->out, " where ");
|
||||
|
||||
TupleHandler(ctx->out, tupdesc, change, isHeap, false);
|
||||
TupleHandler(relation, ctx->out, tupdesc, change, isHeap, false);
|
||||
break;
|
||||
default:
|
||||
Assert(false);
|
||||
|
|
|
|||
|
|
@ -1337,35 +1337,35 @@ static void validateConnectbyTupleDesc(TupleDesc tupdesc, bool show_branch, bool
|
|||
}
|
||||
|
||||
/* check that the types of the first two columns match */
|
||||
if (tupdesc->attrs[0]->atttypid != tupdesc->attrs[1]->atttypid)
|
||||
if (tupdesc->attrs[0].atttypid != tupdesc->attrs[1].atttypid)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||
errmsg("invalid return type"),
|
||||
errdetail("First two columns must be the same type.")));
|
||||
|
||||
/* check that the type of the third column is INT4 */
|
||||
if (tupdesc->attrs[2]->atttypid != INT4OID)
|
||||
if (tupdesc->attrs[2].atttypid != INT4OID)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||
errmsg("invalid return type"),
|
||||
errdetail("Third column must be type %s.", format_type_be(INT4OID))));
|
||||
|
||||
/* check that the type of the fourth column is TEXT if applicable */
|
||||
if (show_branch && tupdesc->attrs[3]->atttypid != TEXTOID)
|
||||
if (show_branch && tupdesc->attrs[3].atttypid != TEXTOID)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||
errmsg("invalid return type"),
|
||||
errdetail("Fourth column must be type %s.", format_type_be(TEXTOID))));
|
||||
|
||||
/* check that the type of the fifth column is INT4 */
|
||||
if (show_branch && show_serial && tupdesc->attrs[4]->atttypid != INT4OID)
|
||||
if (show_branch && show_serial && tupdesc->attrs[4].atttypid != INT4OID)
|
||||
elog(ERROR,
|
||||
"query-specified return tuple not valid for Connectby: "
|
||||
"fifth column must be type %s",
|
||||
format_type_be(INT4OID));
|
||||
|
||||
/* check that the type of the fifth column is INT4 */
|
||||
if (!show_branch && show_serial && tupdesc->attrs[3]->atttypid != INT4OID)
|
||||
if (!show_branch && show_serial && tupdesc->attrs[3].atttypid != INT4OID)
|
||||
elog(ERROR,
|
||||
"query-specified return tuple not valid for Connectby: "
|
||||
"fourth column must be type %s",
|
||||
|
|
@ -1383,8 +1383,8 @@ static bool compatConnectbyTupleDescs(TupleDesc ret_tupdesc, TupleDesc sql_tupde
|
|||
Oid sql_atttypid;
|
||||
|
||||
/* check the key_fld types match */
|
||||
ret_atttypid = ret_tupdesc->attrs[0]->atttypid;
|
||||
sql_atttypid = sql_tupdesc->attrs[0]->atttypid;
|
||||
ret_atttypid = ret_tupdesc->attrs[0].atttypid;
|
||||
sql_atttypid = sql_tupdesc->attrs[0].atttypid;
|
||||
if (ret_atttypid != sql_atttypid)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||
|
|
@ -1393,8 +1393,8 @@ static bool compatConnectbyTupleDescs(TupleDesc ret_tupdesc, TupleDesc sql_tupde
|
|||
"not match return key field datatype.")));
|
||||
|
||||
/* check the parent_key_fld types match */
|
||||
ret_atttypid = ret_tupdesc->attrs[1]->atttypid;
|
||||
sql_atttypid = sql_tupdesc->attrs[1]->atttypid;
|
||||
ret_atttypid = ret_tupdesc->attrs[1].atttypid;
|
||||
sql_atttypid = sql_tupdesc->attrs[1].atttypid;
|
||||
if (ret_atttypid != sql_atttypid)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||
|
|
@ -1421,8 +1421,8 @@ static bool compatCrosstabTupleDescs(TupleDesc ret_tupdesc, TupleDesc sql_tupdes
|
|||
return false;
|
||||
|
||||
/* check the rowid types match */
|
||||
ret_atttypid = ret_tupdesc->attrs[0]->atttypid;
|
||||
sql_atttypid = sql_tupdesc->attrs[0]->atttypid;
|
||||
ret_atttypid = ret_tupdesc->attrs[0].atttypid;
|
||||
sql_atttypid = sql_tupdesc->attrs[0].atttypid;
|
||||
if (ret_atttypid != sql_atttypid)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||
|
|
|
|||
|
|
@ -199,15 +199,13 @@ static bool pg_decode_filter(LogicalDecodingContext* ctx, RepOriginId origin_id)
|
|||
return true;
|
||||
return false;
|
||||
}
|
||||
static void tuple_to_stringinfo(StringInfo s, TupleDesc tupdesc, HeapTuple tuple, bool skip_nulls)
|
||||
static void tuple_to_stringinfo(Relation relation, StringInfo s, TupleDesc tupdesc, HeapTuple tuple, bool isOld)
|
||||
{
|
||||
if (HEAP_TUPLE_IS_COMPRESSED(tuple->t_data))
|
||||
if ((tuple->tupTableType == HEAP_TUPLE) && (HEAP_TUPLE_IS_COMPRESSED(tuple->t_data) ||
|
||||
(int)HeapTupleHeaderGetNatts(tuple->t_data, tupdesc) > tupdesc->natts)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((int)HeapTupleHeaderGetNatts(tuple->t_data, tupdesc) != tupdesc->natts)
|
||||
return;
|
||||
|
||||
int natt;
|
||||
Oid oid;
|
||||
|
||||
/* print oid of tuple, it's not included in the TupleDesc */
|
||||
|
|
@ -216,15 +214,14 @@ static void tuple_to_stringinfo(StringInfo s, TupleDesc tupdesc, HeapTuple tuple
|
|||
}
|
||||
|
||||
/* print all columns individually */
|
||||
for (natt = 0; natt < tupdesc->natts; natt++) {
|
||||
for (int natt = 0; natt < tupdesc->natts; natt++) {
|
||||
Form_pg_attribute attr; /* the attribute itself */
|
||||
Oid typid; /* type of current attribute */
|
||||
Oid typoutput; /* output function */
|
||||
bool typisvarlena = false;
|
||||
Datum origval; /* possibly toasted Datum */
|
||||
bool isnull = true; /* column is null? */
|
||||
|
||||
attr = tupdesc->attrs[natt];
|
||||
attr = &tupdesc->attrs[natt];
|
||||
|
||||
/*
|
||||
* don't print dropped columns, we can't be sure everything is
|
||||
|
|
@ -237,16 +234,17 @@ static void tuple_to_stringinfo(StringInfo s, TupleDesc tupdesc, HeapTuple tuple
|
|||
* Don't print system columns, oid will already have been printed if
|
||||
* present.
|
||||
*/
|
||||
if (attr->attnum < 0)
|
||||
if (attr->attnum < 0 || (isOld && !IsRelationReplidentKey(relation, attr->attnum)))
|
||||
continue;
|
||||
|
||||
typid = attr->atttypid;
|
||||
Oid typid = attr->atttypid; /* type of current attribute */
|
||||
|
||||
/* get Datum from tuple */
|
||||
origval = heap_getattr(tuple, natt + 1, tupdesc, &isnull);
|
||||
|
||||
if (isnull && skip_nulls)
|
||||
continue;
|
||||
if (tuple->tupTableType == HEAP_TUPLE) {
|
||||
origval = heap_getattr(tuple, natt + 1, tupdesc, &isnull);
|
||||
} else {
|
||||
origval = uheap_getattr((UHeapTuple)tuple, natt + 1, tupdesc, &isnull);
|
||||
}
|
||||
|
||||
/* print attribute name */
|
||||
appendStringInfoChar(s, ' ');
|
||||
|
|
@ -327,20 +325,40 @@ static void pg_decode_change(
|
|||
if (change->data.tp.newtuple == NULL)
|
||||
appendStringInfoString(ctx->out, " (no-tuple-data)");
|
||||
else
|
||||
tuple_to_stringinfo(ctx->out, tupdesc, &change->data.tp.newtuple->tuple, false);
|
||||
tuple_to_stringinfo(relation, ctx->out, tupdesc, &change->data.tp.newtuple->tuple, false);
|
||||
break;
|
||||
case REORDER_BUFFER_CHANGE_UINSERT:
|
||||
appendStringInfoString(ctx->out, " INSERT:");
|
||||
if (change->data.utp.newtuple == NULL)
|
||||
appendStringInfoString(ctx->out, " (no-tuple-data)");
|
||||
else
|
||||
tuple_to_stringinfo(relation, ctx->out, tupdesc, (HeapTuple)(&change->data.utp.newtuple->tuple), false);
|
||||
break;
|
||||
case REORDER_BUFFER_CHANGE_UPDATE:
|
||||
appendStringInfoString(ctx->out, " UPDATE:");
|
||||
if (change->data.tp.oldtuple != NULL) {
|
||||
appendStringInfoString(ctx->out, " old-key:");
|
||||
tuple_to_stringinfo(ctx->out, tupdesc, &change->data.tp.oldtuple->tuple, true);
|
||||
tuple_to_stringinfo(relation, ctx->out, tupdesc, &change->data.tp.oldtuple->tuple, true);
|
||||
appendStringInfoString(ctx->out, " new-tuple:");
|
||||
}
|
||||
|
||||
if (change->data.tp.newtuple == NULL)
|
||||
appendStringInfoString(ctx->out, " (no-tuple-data)");
|
||||
else
|
||||
tuple_to_stringinfo(ctx->out, tupdesc, &change->data.tp.newtuple->tuple, false);
|
||||
tuple_to_stringinfo(relation, ctx->out, tupdesc, &change->data.tp.newtuple->tuple, false);
|
||||
break;
|
||||
case REORDER_BUFFER_CHANGE_UUPDATE:
|
||||
appendStringInfoString(ctx->out, " UPDATE:");
|
||||
if (change->data.utp.oldtuple != NULL) {
|
||||
appendStringInfoString(ctx->out, " old-key:");
|
||||
tuple_to_stringinfo(relation, ctx->out, tupdesc, (HeapTuple)(&change->data.utp.oldtuple->tuple), true);
|
||||
appendStringInfoString(ctx->out, " new-tuple:");
|
||||
}
|
||||
|
||||
if (change->data.utp.newtuple == NULL)
|
||||
appendStringInfoString(ctx->out, " (no-tuple-data)");
|
||||
else
|
||||
tuple_to_stringinfo(relation, ctx->out, tupdesc, (HeapTuple)(&change->data.utp.newtuple->tuple), false);
|
||||
break;
|
||||
case REORDER_BUFFER_CHANGE_DELETE:
|
||||
appendStringInfoString(ctx->out, " DELETE:");
|
||||
|
|
@ -350,7 +368,15 @@ static void pg_decode_change(
|
|||
appendStringInfoString(ctx->out, " (no-tuple-data)");
|
||||
/* In DELETE, only the replica identity is present; display that */
|
||||
else
|
||||
tuple_to_stringinfo(ctx->out, tupdesc, &change->data.tp.oldtuple->tuple, true);
|
||||
tuple_to_stringinfo(relation, ctx->out, tupdesc, &change->data.tp.oldtuple->tuple, true);
|
||||
break;
|
||||
case REORDER_BUFFER_CHANGE_UDELETE:
|
||||
appendStringInfoString(ctx->out, " DELETE:");
|
||||
|
||||
if (change->data.utp.oldtuple == NULL)
|
||||
appendStringInfoString(ctx->out, " (no-tuple-data)");
|
||||
else
|
||||
tuple_to_stringinfo(relation, ctx->out, tupdesc, (HeapTuple)(&change->data.utp.oldtuple->tuple), true);
|
||||
break;
|
||||
default:
|
||||
Assert(false);
|
||||
|
|
|
|||
|
|
@ -1186,7 +1186,7 @@ su - gaussdb
|
|||
the size of each individual file in the WAL log. It may be useful
|
||||
to adjust this size to control the granularity of WAL log shipping.
|
||||
The default size is 16 megabytes.
|
||||
The value must be a power of 2 between 1 and 1024 (megabytes).
|
||||
The value must be a power of 2 between 1 and 512 (megabytes).
|
||||
Note that changing this value requires an gs_initdb.
|
||||
</para>
|
||||
</listitem>
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ Complete list of usable sgml source files in this directory.
|
|||
<!ENTITY alterDatabase SYSTEM "alter_database.sgml">
|
||||
<!ENTITY alterDefaultPrivileges SYSTEM "alter_default_privileges.sgml">
|
||||
<!ENTITY alterDomain SYSTEM "alter_domain.sgml">
|
||||
<!ENTITY alterEventTrigger SYSTEM "alter_event_trigger.sgml">
|
||||
<!ENTITY alterExtension SYSTEM "alter_extension.sgml">
|
||||
<!ENTITY alterForeignDataWrapper SYSTEM "alter_foreign_data_wrapper.sgml">
|
||||
<!ENTITY alterForeignTable SYSTEM "alter_foreign_table.sgml">
|
||||
|
|
@ -64,6 +65,7 @@ Complete list of usable sgml source files in this directory.
|
|||
<!ENTITY createConversion SYSTEM "create_conversion.sgml">
|
||||
<!ENTITY createDatabase SYSTEM "create_database.sgml">
|
||||
<!ENTITY createDomain SYSTEM "create_domain.sgml">
|
||||
<!ENTITY createEventTrigger SYSTEM "create_event_trigger.sgml">
|
||||
<!ENTITY createExtension SYSTEM "create_extension.sgml">
|
||||
<!ENTITY createForeignDataWrapper SYSTEM "create_foreign_data_wrapper.sgml">
|
||||
<!ENTITY createForeignTable SYSTEM "create_foreign_table.sgml">
|
||||
|
|
@ -108,6 +110,7 @@ Complete list of usable sgml source files in this directory.
|
|||
<!ENTITY dropConversion SYSTEM "drop_conversion.sgml">
|
||||
<!ENTITY dropDatabase SYSTEM "drop_database.sgml">
|
||||
<!ENTITY dropDomain SYSTEM "drop_domain.sgml">
|
||||
<!ENTITY dropEventTrigger SYSTEM "drop_event_trigger.sgml">
|
||||
<!ENTITY dropExtension SYSTEM "drop_extension.sgml">
|
||||
<!ENTITY dropForeignDataWrapper SYSTEM "drop_foreign_data_wrapper.sgml">
|
||||
<!ENTITY dropForeignTable SYSTEM "drop_foreign_table.sgml">
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
<refentry id="SQL-ALTEREVENTTRIGGER">
|
||||
<refmeta>
|
||||
<refentrytitle>ALTER EVENT TRIGGER</refentrytitle>
|
||||
<manvolnum>7</manvolnum>
|
||||
<refmiscinfo>SQL - Language Statements</refmiscinfo>
|
||||
</refmeta>
|
||||
<refnamediv>
|
||||
<refname>ALTER EVENT TRIGGER</refname>
|
||||
<refpurpose>change the definition of an event trigger</refpurpose>
|
||||
</refnamediv>
|
||||
<refsynopsisdiv>
|
||||
<indexterm zone="sql-altereventtrigger">
|
||||
<primary>ALTER EVENT TRIGGER</primary>
|
||||
</indexterm>
|
||||
<refsynopsisdiv>
|
||||
<synopsis>
|
||||
ALTER EVENT TRIGGER name DISABLE
|
||||
ALTER EVENT TRIGGER name ENABLE [ REPLICA | ALWAYS ]
|
||||
ALTER EVENT TRIGGER name OWNER TO { new_owner | CURRENT_USER | SESSION_USER }
|
||||
ALTER EVENT TRIGGER name RENAME TO new_name
|
||||
</synopsis>
|
||||
</refsynopsisdiv>
|
||||
</refentry>
|
||||
|
|
@ -15,6 +15,9 @@ ALTER SCHEMA schema_name
|
|||
ALTER SCHEMA schema_name
|
||||
OWNER TO new_owner;
|
||||
ALTER SCHEMA schema_name {WITH | WITHOUT} BLOCKCHAIN;
|
||||
ALTER SCHEMA schema_name
|
||||
[ [ DEFAULT ] CHARACTER SET | CHARSET [ = ] charset ] [ [ DEFAULT ] COLLATE [ = ] collation ];
|
||||
NOTICE: '[ [ DEFAULT ] CHARACTER SET | CHARSET [ = ] charset ] [ [ DEFAULT ] COLLATE [ = ] collation ]' is only available in CENTRALIZED mode and B-format database!
|
||||
</synopsis>
|
||||
</refsynopsisdiv>
|
||||
</refentry>
|
||||
|
|
@ -52,11 +52,18 @@ column_clause
|
|||
| NO FORCE ROW LEVEL SECURITY
|
||||
| ENCRYPTION KEY ROTATION
|
||||
| AUTO_INCREMENT [ = ] value
|
||||
| ALTER INDEX index_name [ VISBLE | INVISIBLE ]
|
||||
| [ [ DEFAULT ] CHARACTER SET | CHARSET [ = ] charset ] [ [ DEFAULT ] COLLATE [ = ] collation ]
|
||||
| CONVERT TO CHARACTER SET | CHARSET charset [ COLLATE collation ]
|
||||
NOTICE: '[ CHARACTER SET | CHARSET ]' is only available in CENTRALIZED mode and B-format database!
|
||||
NOTICE: '[ COLLATE ]' is only available in CENTRALIZED mode and B-format database!
|
||||
where column_clause can be:
|
||||
ADD [ COLUMN ] column_name data_type [ compress_mode ] [ COLLATE collation ] [ column_constraint [ ... ] ]
|
||||
ADD [ COLUMN ] column_name data_type [ CHARACTER SET | CHARSET charset ] [ compress_mode ] [ COLLATE collation ] [ column_constraint [ ... ] ] [ FIRST | AFTER column_name ]
|
||||
| MODIFY column_name data_type
|
||||
| MODIFY column_name [ CONSTRAINT constraint_name ] NOT NULL [ ENABLE ]
|
||||
| MODIFY column_name [ CONSTRAINT constraint_name ] NULL
|
||||
| MODIFY [ COLUMN ] column_name data_type [ CHARACTER SET | CHARSET charset ] [ COLLATE collation ] [ column_constraint [ ... ] ] [FIRST | AFTER column_name]
|
||||
| CHANGE [ COLUMN ] column_name new_column_name data_type [ CHARACTER SET | CHARSET charset ] [ COLLATE collation ] [ column_constraint [ ... ] ] [FIRST | AFTER column_name]
|
||||
| DROP [ COLUMN ] [ IF EXISTS ] column_name [ RESTRICT | CASCADE ]
|
||||
| ALTER [ COLUMN ] column_name [ SET DATA ] TYPE data_type [ COLLATE collation ] [ USING expression ]
|
||||
| ALTER [ COLUMN ] column_name { SET DEFAULT expression | DROP DEFAULT }
|
||||
|
|
@ -67,27 +74,30 @@ ADD [ COLUMN ] column_name data_type [ compress_mode ] [ COLLATE collation ] [ c
|
|||
| ALTER [ COLUMN ] column_name SET ( {attribute_option = value} [, ... ] )
|
||||
| ALTER [ COLUMN ] column_name RESET ( attribute_option [, ... ] )
|
||||
| ALTER [ COLUMN ] column_name SET STORAGE { PLAIN | EXTERNAL | EXTENDED | MAIN }
|
||||
NOTICE: 'MODIFY [ COLUMN ] ...' action is only available in CENTRALIZED mode and B-format database!
|
||||
NOTICE: 'CHANGE [ COLUMN ] ...' action is only available in CENTRALIZED mode and B-format database!
|
||||
where column_constraint can be:
|
||||
[ CONSTRAINT constraint_name ]
|
||||
{ NOT NULL |
|
||||
NULL |
|
||||
CHECK ( expression ) |
|
||||
DEFAULT default_expr |
|
||||
GENERATED ALWAYS AS ( generation_expr ) STORED |
|
||||
GENERATED ALWAYS AS ( generation_expr ) [STORED] |
|
||||
AUTO_INCREMENT |
|
||||
UNIQUE index_parameters |
|
||||
UNIQUE [KEY] index_parameters |
|
||||
PRIMARY KEY index_parameters |
|
||||
ENCRYPTED WITH ( COLUMN_ENCRYPTION_KEY = column_encryption_key, ENCRYPTION_TYPE = encryption_type_value ) |
|
||||
REFERENCES reftable [ ( refcolumn ) ] [ MATCH FULL | MATCH PARTIAL | MATCH SIMPLE ]
|
||||
[ ON DELETE action ] [ ON UPDATE action ] }
|
||||
[ DEFERRABLE | NOT DEFERRABLE | INITIALLY DEFERRED | INITIALLY IMMEDIATE ]
|
||||
NOTICE: 'UNIQUE KEY' in table_constraint is only available in CENTRALIZED mode and B-format database!
|
||||
where compress_mode can be:
|
||||
{ DELTA | PREFIX | DICTIONARY | NUMSTR | NOCOMPRESS }
|
||||
where table_constraint can be:
|
||||
[ CONSTRAINT [ constraint_name ] ]
|
||||
{ CHECK ( expression ) |
|
||||
UNIQUE [ idx_name ] [ USING method ] ( { { column_name | ( expression ) } [ ASC | DESC ] } [, ... ] ) index_parameters |
|
||||
PRIMARY KEY [ USING method ] ( { column_name [ ASC | DESC ] }[, ... ] ) index_parameters |
|
||||
UNIQUE [ idx_name ] [ USING method ] ( { { column_name | ( expression ) } [ ASC | DESC ] } [, ... ] ) index_parameters [ VISIBLE | INVISIBLE ] |
|
||||
PRIMARY KEY [ USING method ] ( { column_name [ ASC | DESC ] }[, ... ] ) index_parameters [ VISIBLE | INVISIBLE ] |
|
||||
PARTIAL CLUSTER KEY ( column_name [, ... ] ) |
|
||||
FOREIGN KEY [ idx_name ] ( column_name [, ... ] ) REFERENCES reftable [ ( refcolumn [, ... ] ) ]
|
||||
[ MATCH FULL | MATCH PARTIAL | MATCH SIMPLE ] [ ON DELETE action ] [ ON UPDATE action ] }
|
||||
|
|
@ -101,11 +111,15 @@ where table_constraint_using_index can be:
|
|||
[ DEFERRABLE | NOT DEFERRABLE | INITIALLY DEFERRED | INITIALLY IMMEDIATE ]
|
||||
|
||||
NOTICE: '[ constraint_name ]' in table_constraint is optional in CENTRALIZED mode and B-format database, it is mandatory in other scenarios.
|
||||
NOTICE: '[ index_name ]' in table_constraint is only avaliable in CENTRALIZED mode and B-format database!
|
||||
NOTICE: '[ USING method ]' in table_constraint is only avaliable in CENTRALIZED mode and B-format database!
|
||||
NOTICE: '[ ASC | DESC ]' in table_constraint is only avaliable in CENTRALIZED mode and B-format database!
|
||||
NOTICE: '( expression )' in 'UNIQUE' clause of table_constraint is only avaliable in CENTRALIZED mode and B-format database!
|
||||
NOTICE: 'AUTO_INCREMENT' is only avaliable in CENTRALIZED mode and B-format database!
|
||||
NOTICE: '[ index_name ]' in table_constraint is only available in CENTRALIZED mode and B-format database!
|
||||
NOTICE: '[ USING method ]' in table_constraint is only available in CENTRALIZED mode and B-format database!
|
||||
NOTICE: '[ ASC | DESC ]' in table_constraint is only available in CENTRALIZED mode and B-format database!
|
||||
NOTICE: '( expression )' in 'UNIQUE' clause of table_constraint is only available in CENTRALIZED mode and B-format database!
|
||||
NOTICE: 'AUTO_INCREMENT' is only available in CENTRALIZED mode and B-format database!
|
||||
NOTICE: '[ FIRST | AFTER column_name ]' clause is only available in CENTRALIZED mode!
|
||||
NOTICE: '[ FIRST | AFTER column_name ]' in 'MODIFY | CHANGE [ COLUMN ] ...' clause is only available in B-format database!
|
||||
NOTICE: '[ CHARACTER SET | CHARSET charset ]' is only available in CENTRALIZED mode and B-format database!
|
||||
NOTICE: '[ VISIBLE | INVISIBLE ]' is only avaliable in CENTRALIZED mode and B-format database!
|
||||
</synopsis>
|
||||
</refsynopsisdiv>
|
||||
</refentry>
|
||||
|
|
|
|||
|
|
@ -11,9 +11,7 @@
|
|||
<refsynopsisdiv>
|
||||
<synopsis>
|
||||
ALTER TABLE [ IF EXISTS ] { table_name [*] | ONLY table_name | ONLY ( table_name )}
|
||||
action [, ... ];
|
||||
ALTER TABLE [ IF EXISTS ] { table_name [*] | ONLY table_name | ONLY ( table_name )}
|
||||
RENAME PARTITION { partion_name | FOR ( partition_value [, ...] ) } TO partition_new_name;
|
||||
{ action [, ... ] | rename_clause | reset_clause };
|
||||
|
||||
where action can be:
|
||||
move_clause |
|
||||
|
|
@ -30,16 +28,16 @@ MOVE PARTITION { partion_name | FOR ( partition_value [, ...] ) } TABLESPACE tab
|
|||
where exchange_clause can be:
|
||||
EXCHANGE PARTITION { ( partition_name ) | FOR ( partition_value [, ...] ) }
|
||||
WITH TABLE {[ ONLY ] ordinary_table_name | ordinary_table_name * | ONLY ( ordinary_table_name )}
|
||||
[ { WITH | WITHOUT } VALIDATION ] [ VERBOSE ]
|
||||
[ { WITH | WITHOUT } VALIDATION ] [ VERBOSE ] [ UPDATE GLOBAL INDEX ]
|
||||
where row_clause can be:
|
||||
{ ENABLE | DISABLE } ROW MOVEMENT
|
||||
where merge_clause can be:
|
||||
MERGE PARTITIONS { partition_name } [, ...] INTO PARTITION partition_name
|
||||
[ TABLESPACE tablespacename ]
|
||||
[ TABLESPACE tablespacename ] [ UPDATE GLOBAL INDEX ]
|
||||
where modify_clause can be:
|
||||
MODIFY PARTITION partition_name { UNUSABLE LOCAL INDEXES | REBUILD UNUSABLE LOCAL INDEXES }
|
||||
where split_clause can be:
|
||||
SPLIT PARTITION { partition_name | FOR ( partition_value [, ...] ) } { split_point_clause | no_split_point_clause }
|
||||
SPLIT PARTITION { partition_name | FOR ( partition_value [, ...] ) } { split_point_clause | no_split_point_clause } [ UPDATE GLOBAL INDEX ]
|
||||
where split_point_clause can be:
|
||||
AT ( partition_value ) INTO ( PARTITION partition_name [ TABLESPACE tablespacename ] , PARTITION partition_name [ TABLESPACE tablespacename ] )
|
||||
where no_split_point_clause can be:
|
||||
|
|
@ -60,10 +58,13 @@ PARTITION partition_name {
|
|||
{END({partition_value | MAXVALUE})}
|
||||
} [TABLESPACE tablespace_name]
|
||||
where drop_clause can be:
|
||||
DROP PARTITION { partition_name | FOR ( partition_value [, ...] ) }
|
||||
DROP PARTITION { partition_name | FOR ( partition_value [, ...] ) } [ UPDATE GLOBAL INDEX ]
|
||||
where truncate_clause can be:
|
||||
TRUNCATE PARTITION { partition_name | FOR ( partition_value [, ...] ) } [ UPDATE GLOBAL INDEX ]
|
||||
NOTICE: 'truncate_clause' is only avaliable in CENTRALIZED mode!
|
||||
where rename_clause can be:
|
||||
RENAME PARTITION { partion_name | FOR ( partition_value [, ...] ) } TO partition_new_name;
|
||||
where reset_clause can be:
|
||||
RESET PARTITION;
|
||||
</synopsis>
|
||||
</refsynopsisdiv>
|
||||
</refentry>
|
||||
|
|
@ -11,13 +11,16 @@
|
|||
<refsynopsisdiv>
|
||||
<synopsis>
|
||||
ALTER TABLE [ IF EXISTS ] { table_name [*] | ONLY table_name | ONLY ( table_name )}
|
||||
action [, ... ];
|
||||
{ action [, ... ] | reset_clause };
|
||||
|
||||
where action can be:
|
||||
row_clause |
|
||||
add_clause |
|
||||
drop_clause |
|
||||
split_clause |
|
||||
truncate_clause
|
||||
where row_clause can be:
|
||||
{ ENABLE | DISABLE } ROW MOVEMENT
|
||||
where add_clause can be:
|
||||
ADD { partition_less_than_item | partition_list_item } [ ( subpartition_definition_list ) ]
|
||||
MODIFY PARTITION partition_name ADD subpartition_definition
|
||||
|
|
@ -26,7 +29,7 @@ PARTITION partition_name VALUES LESS THAN ( partition_value | MAXVALUE ) [ TABLE
|
|||
where partition_list_item can be:
|
||||
PARTITION partition_name VALUES ( partition_value [, ...] | DEFAULT ) [ TABLESPACE tablespacename ]
|
||||
where subpartition_definition_list can be:
|
||||
SUBPARTITION subpartition_name [ VALUES LESS THAN ( partition_value | MAXVALUE ) | VALUES ( partition_value [, ...] | DEFAULT )] [ TABLESPACE tablespace ]
|
||||
SUBPARTITION subpartition_name { VALUES LESS THAN ( partition_value | MAXVALUE ) | VALUES ( partition_value [, ...] | DEFAULT ) } [ TABLESPACE tablespace ]
|
||||
where drop_clause can be:
|
||||
DROP PARTITION { partition_name | FOR ( partition_value ) } [ UPDATE GLOBAL INDEX ]
|
||||
DROP SUBPARTITION { subpartition_name | FOR ( partition_value, subpartition_value ) } [ UPDATE GLOBAL INDEX ]
|
||||
|
|
@ -37,7 +40,8 @@ AT ( subpartition_value ) INTO ( SUBPARTITION subpartition_name [ TABLESPACE tab
|
|||
VALUES ( subpartition_value ) INTO ( SUBPARTITION subpartition_name [ TABLESPACE tablespacename ] , SUBPARTITION subpartition_name [ TABLESPACE tablespacename ] )
|
||||
where truncate_clause can be:
|
||||
TRUNCATE SUBPARTITION { subpartition_name } [ UPDATE GLOBAL INDEX ]
|
||||
NOTICE: 'ALTER TABLE SUBPARTITION' is only avaliable in CENTRALIZED mode!
|
||||
where reset_clause can be:
|
||||
RESET PARTITION;
|
||||
</synopsis>
|
||||
</refsynopsisdiv>
|
||||
</refentry>
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
[ table_name [ ( column_name [, ...] ) ] ];
|
||||
{ANALYZE | ANALYSE} [ VERBOSE ]
|
||||
[ table_name [ ( column_name [, ...] ) ] ]
|
||||
PARTITION patrition_name;
|
||||
PARTITION (partition_name);
|
||||
{ANALYZE | ANALYSE} [ VERBOSE ]
|
||||
{ foreign_table_name | FOREIGN TABLES };
|
||||
{ANALYZE | ANALYSE} [ VERBOSE ]
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
{ANALYZE | ANALYSE} VERIFY {FAST|COMPLETE}
|
||||
table_name|index_name [CASCADE];
|
||||
{ANALYZE | ANALYSE} VERIFY {FAST|COMPLETE}
|
||||
table_name PARTITION (patrition_name) [CASCADE];
|
||||
table_name PARTITION (partition_name) [CASCADE];
|
||||
</synopsis>
|
||||
</refsynopsisdiv>
|
||||
</refentry>
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
[ table_name [ ( column_name [, ...] ) ] ];
|
||||
{ ANALYZE | ANALYSE } [ VERBOSE ]
|
||||
[ table_name [ ( column_name [, ...] ) ] ]
|
||||
PARTITION patrition_name;
|
||||
PARTITION (partition_name);
|
||||
{ ANALYZE | ANALYSE } [ VERBOSE ]
|
||||
{ foreign_table_name | FOREIGN TABLES };
|
||||
{ ANALYZE | ANALYSE } [ VERBOSE ]
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
{ ANALYZE | ANALYSE } VERIFY { FAST | COMPLETE };
|
||||
{ ANALYZE | ANALYSE } VERIFY { FAST | COMPLETE } table_name | index_name [ CASCADE ];
|
||||
{ ANALYZE | ANALYSE } VERIFY { FAST | COMPLETE }
|
||||
table_name PARTITION (patrition_name) [ CASCADE ];
|
||||
table_name PARTITION (partition_name) [ CASCADE ];
|
||||
</synopsis>
|
||||
</refsynopsisdiv>
|
||||
</refentry>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
<refentry id="SQL-CREATEEVENTTRIGGER">
|
||||
<refmeta>
|
||||
<refentrytitle>CREATE EVENT TRIGGER</refentrytitle>
|
||||
<manvolnum>7</manvolnum>
|
||||
<refmiscinfo>SQL - Language Statements</refmiscinfo>
|
||||
</refmeta>
|
||||
<refnamediv>
|
||||
<refname>CREATE EVENT TRIGGER</refname>
|
||||
<refpurpose>define a new event trigger</refpurpose>
|
||||
</refnamediv>
|
||||
<refsynopsisdiv>
|
||||
<indexterm zone="sql-createeventtrigger">
|
||||
<primary>CREATE EVENT TRIGGER</primary>
|
||||
</indexterm>
|
||||
<refsynopsisdiv>
|
||||
<synopsis>
|
||||
CREATE EVENT TRIGGER name
|
||||
ON event
|
||||
[ WHEN filter_variable IN (filter_value [, ... ]) [ AND ... ] ]
|
||||
EXECUTE PROCEDURE function name()
|
||||
</synopsis>
|
||||
</refsynopsisdiv>
|
||||
</refentry>
|
||||
|
|
@ -10,21 +10,24 @@
|
|||
</refnamediv>
|
||||
<refsynopsisdiv>
|
||||
<synopsis>
|
||||
CREATE [ UNIQUE ] INDEX [ CONCURRENTLY ] [ [schema_name.] index_name ] ON table_name [ USING method ]
|
||||
CREATE [ UNIQUE ] INDEX [ CONCURRENTLY ] [ IF NOT EXISTS ] [ [schema_name.] index_name ] ON table_name [ USING method ]
|
||||
({ { column_name [ ( length ) ] | ( expression ) } [ COLLATE collation ] [ opclass ] [ ASC | DESC ] [ NULLS { FIRST | LAST } ] }[, ...] )
|
||||
[ INCLUDE ( { column_name | ( expression ) }[, ...] ) ]
|
||||
[ WITH ( {storage_parameter = value} [, ... ] ) ]
|
||||
[ TABLESPACE tablespace_name ]
|
||||
[ VISIBLE | INVISIBLE ]
|
||||
[ WHERE predicate ];
|
||||
CREATE [ UNIQUE ] INDEX [ [schema_name.] index_name ] ON table_name [ USING method ]
|
||||
CREATE [ UNIQUE ] INDEX [ IF NOT EXISTS ] [ [schema_name.] index_name ] ON table_name [ USING method ]
|
||||
( { { column_name | ( expression ) } [ COLLATE collation ] [ opclass ] [ ASC | DESC ] [ NULLS LAST ] } [, ...] )
|
||||
[ LOCAL [ ( { PARTITION index_partition_name | SUBPARTITION index_subpartition_name [ TABLESPACE index_partition_tablespace ] } [, ...] ) ] | GLOBAL ]
|
||||
[ INCLUDE ( { column_name | ( expression ) }[, ...] ) ]
|
||||
[ WITH ( { storage_parameter = value } [, ...] ) ]
|
||||
[ TABLESPACE tablespace_name ];
|
||||
[ TABLESPACE tablespace_name ]
|
||||
[ VISIBLE | INVISIBLE ];
|
||||
|
||||
NOTICE: 'SUBPARTITION index_subpartition_name' is only avaliable in CENTRALIZED mode!
|
||||
NOTICE: 'column_name ( length )' is only avaliable in B-format database!
|
||||
NOTICE: '[ VISIBLE | INVISIBLE ]' is only avaliable in CENTRALIZED mode and B-format database!
|
||||
</synopsis>
|
||||
</refsynopsisdiv>
|
||||
</refentry>
|
||||
|
|
|
|||
|
|
@ -12,6 +12,9 @@
|
|||
<synopsis>
|
||||
CREATE SCHEMA [ IF NOT EXISTS ] schema_name
|
||||
[ AUTHORIZATION user_name ] [WITH BLOCKCHAIN] [ schema_element [ ... ] ];
|
||||
CREATE SCHEMA schema_name
|
||||
[ [ DEFAULT ] CHARACTER SET | CHARSET [ = ] charset ] [ [ DEFAULT ] COLLATE [ = ] collation ];
|
||||
NOTICE: '[ [ DEFAULT ] CHARACTER SET | CHARSET [ = ] charset ] [ [ DEFAULT ] COLLATE [ = ] collation ]' is only available in CENTRALIZED mode and B-format database!
|
||||
</synopsis>
|
||||
</refsynopsisdiv>
|
||||
</refentry>
|
||||
|
|
@ -11,11 +11,13 @@
|
|||
<refsynopsisdiv>
|
||||
<synopsis>
|
||||
CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE [ IF NOT EXISTS ] table_name
|
||||
( { column_name data_type [ compress_mode ] [ COLLATE collation ] [ column_constraint [ ... ] ]
|
||||
( { column_name data_type [ CHARACTER SET | CHARSET charset ]
|
||||
[ compress_mode ] [ COLLATE collation ] [ column_constraint [ ... ] ]
|
||||
| table_constraint
|
||||
| LIKE source_table [ like_option [...] ] }
|
||||
[, ... ])
|
||||
[ AUTO_INCREMENT [ = ] value ]
|
||||
[ [ DEFAULT ] CHARACTER SET | CHARSET [ = ] charset ] [ [ DEFAULT ] COLLATE [ = ] collation ]
|
||||
[ WITH ( {storage_parameter = value} [, ... ] ) ]
|
||||
[ ON COMMIT { PRESERVE ROWS | DELETE ROWS | DROP } ]
|
||||
[ COMPRESS | NOCOMPRESS ]
|
||||
|
|
@ -27,19 +29,20 @@ where column_constraint can be:
|
|||
NULL |
|
||||
CHECK ( expression ) |
|
||||
DEFAULT default_expr |
|
||||
GENERATED ALWAYS AS ( generation_expr ) STORED |
|
||||
GENERATED ALWAYS AS ( generation_expr ) [STORED] |
|
||||
AUTO_INCREMENT |
|
||||
UNIQUE index_parameters |
|
||||
UNIQUE [KEY] index_parameters |
|
||||
PRIMARY KEY index_parameters |
|
||||
ENCRYPTED WITH ( COLUMN_ENCRYPTION_KEY = column_encryption_key, ENCRYPTION_TYPE = encryption_type_value ) |
|
||||
REFERENCES reftable [ ( refcolumn ) ] [ MATCH FULL | MATCH PARTIAL | MATCH SIMPLE ]
|
||||
[ ON DELETE action ] [ ON UPDATE action ] }
|
||||
[ DEFERRABLE | NOT DEFERRABLE | INITIALLY DEFERRED | INITIALLY IMMEDIATE ]
|
||||
NOTICE: 'UNIQUE KEY' in table_constraint is only available in CENTRALIZED mode and B-format database!
|
||||
where table_constraint can be:
|
||||
[ CONSTRAINT [ constraint_name ] ]
|
||||
{ CHECK ( expression ) |
|
||||
UNIQUE [ index_name ] [ USING method ] ( { { column_name | ( expression ) } [ ASC | DESC ] } [, ... ] ) index_parameters |
|
||||
PRIMARY KEY [ USING method ] ( { column_name [ ASC | DESC ] } [, ... ] ) index_parameters |
|
||||
UNIQUE [ index_name ] [ USING method ] ( { { column_name | ( expression ) } [ ASC | DESC ] } [, ... ] ) index_parameters [ VISIBLE | INVISIBLE ] |
|
||||
PRIMARY KEY [ USING method ] ( { column_name [ ASC | DESC ] } [, ... ] ) index_parameters [ VISIBLE | INVISIBLE ] |
|
||||
PARTIAL CLUSTER KEY ( column_name [, ... ] ) |
|
||||
FOREIGN KEY [ index_name ] ( column_name [, ... ] ) REFERENCES reftable [ ( refcolumn [, ... ] ) ]
|
||||
[ MATCH FULL | MATCH PARTIAL | MATCH SIMPLE ] [ ON DELETE action ] [ ON UPDATE action ] }
|
||||
|
|
@ -66,11 +69,14 @@ where list_distribution_rules can be:
|
|||
]
|
||||
|
||||
NOTICE: '[ constraint_name ]' in table_constraint is optional in CENTRALIZED mode and B-format database, it is mandatory in other scenarios.
|
||||
NOTICE: '[ index_name ]' in table_constraint is only avaliable in CENTRALIZED mode and B-format database!
|
||||
NOTICE: '[ USING method ]' in table_constraint is only avaliable in CENTRALIZED mode and B-format database!
|
||||
NOTICE: '[ ASC | DESC ]' in table_constraint is only avaliable in CENTRALIZED mode and B-format database!
|
||||
NOTICE: '( expression )' in 'UNIQUE' clause of table_constraint is only avaliable in CENTRALIZED mode and B-format database!
|
||||
NOTICE: 'AUTO_INCREMENT' is only avaliable in CENTRALIZED mode and B-format database!
|
||||
NOTICE: '[ index_name ]' in table_constraint is only available in CENTRALIZED mode and B-format database!
|
||||
NOTICE: '[ USING method ]' in table_constraint is only available in CENTRALIZED mode and B-format database!
|
||||
NOTICE: '[ ASC | DESC ]' in table_constraint is only available in CENTRALIZED mode and B-format database!
|
||||
NOTICE: '( expression )' in 'UNIQUE' clause of table_constraint is only available in CENTRALIZED mode and B-format database!
|
||||
NOTICE: 'AUTO_INCREMENT' is only available in CENTRALIZED mode and B-format database!
|
||||
NOTICE: '[ CHARACTER SET | CHARSET ]' is only available in CENTRALIZED mode and B-format database!
|
||||
NOTICE: '[ COLLATE [ = ] collation ]' is only available in CENTRALIZED mode and B-format database!
|
||||
NOTICE: '[ VISIBLE | INVISIBLE ]' is only avaliable in CENTRALIZED mode and B-format database!
|
||||
</synopsis>
|
||||
</refsynopsisdiv>
|
||||
</refentry>
|
||||
|
|
|
|||
|
|
@ -12,38 +12,46 @@
|
|||
<synopsis>
|
||||
CREATE TABLE [ IF NOT EXISTS ] partition_table_name
|
||||
( [
|
||||
{ column_name data_type [ COLLATE collation ] [ column_constraint [ ... ] ]
|
||||
{ column_name data_type [ CHARACTER SET | CHARSET charset ]
|
||||
[ COLLATE collation ] [ column_constraint [ ... ] ]
|
||||
| table_constraint
|
||||
| LIKE source_table [ like_option [...] ] }
|
||||
[, ... ]
|
||||
] )
|
||||
[ AUTO_INCREMENT [ = ] value ]
|
||||
[ [ DEFAULT ] CHARACTER SET | CHARSET [ = ] charset ][ [ DEFAULT ] COLLATE [ = ] collation ]
|
||||
[ WITH ( {storage_parameter = value} [, ... ] ) ]
|
||||
[ COMPRESS | NOCOMPRESS ]
|
||||
[ TABLESPACE tablespace_name ]
|
||||
[ DISTRIBUTE BY { REPLICATION | { [ HASH ] ( column_name ) } } ]
|
||||
NOTICE: DISTRIBUTE BY is only avaliable in DISTRIBUTED mode!
|
||||
[ TO { GROUP groupname | NODE ( nodename [, ... ] ) } ]
|
||||
PARTITION BY {
|
||||
{VALUES (partition_key)} |
|
||||
{RANGE (partition_key) [ INTERVAL ('interval_expr') [ STORE IN ( tablespace_name [, ...] ) ] ] ( partition_less_than_item [, ... ] )} |
|
||||
{RANGE (partition_key) [ INTERVAL ('interval_expr') [ STORE IN ( tablespace_name [, ...] ) ] ] ( partition_start_end_item [, ... ] )} |
|
||||
{LIST | HASH (partition_key) (PARTITION partition_name [ VALUES (list_values_clause) ] opt_table_space ) }
|
||||
NOTICE: LIST/HASH partition is only avaliable in CENTRALIZED mode!
|
||||
{RANGE [ COLUMNS ] (partition_key) [ INTERVAL ('interval_expr') [ STORE IN ( tablespace_name [, ...] ) ] ] [ PARTITIONS integer ] ( partition_less_than_item [, ... ] )} |
|
||||
{RANGE [ COLUMNS ] (partition_key) [ INTERVAL ('interval_expr') [ STORE IN ( tablespace_name [, ...] ) ] ] [ PARTITIONS integer ] ( partition_start_end_item [, ... ] )} |
|
||||
{{{LIST [ COLUMNS ]} | HASH | KEY} (partition_key) [ PARTITIONS integer ] (PARTITION partition_name [ VALUES [ IN ] (list_values_clause) ] opt_table_space ) }
|
||||
} [ { ENABLE | DISABLE } ROW MOVEMENT ];
|
||||
|
||||
NOTICE: [ COLUMNS ] is only available in B-format database!
|
||||
NOTICE: [ PARTITIONS integer ] in RANGE/LIST partition is only available in B-format database!
|
||||
NOTICE: [ IN ] is only available in B-format database!
|
||||
NOTICE: KEY is only available in B-format database!
|
||||
|
||||
where column_constraint can be:
|
||||
[ CONSTRAINT constraint_name ]
|
||||
{ NOT NULL |
|
||||
NULL |
|
||||
CHECK ( expression ) |
|
||||
DEFAULT default_expr |
|
||||
GENERATED ALWAYS AS ( generation_expr ) STORED |
|
||||
GENERATED ALWAYS AS ( generation_expr ) [STORED] |
|
||||
AUTO_INCREMENT |
|
||||
UNIQUE index_parameters |
|
||||
UNIQUE [KEY] index_parameters |
|
||||
PRIMARY KEY index_parameters |
|
||||
REFERENCES reftable [ ( refcolumn ) ] [ MATCH FULL | MATCH PARTIAL | MATCH SIMPLE ]
|
||||
[ ON DELETE action ] [ ON UPDATE action ] }
|
||||
[ DEFERRABLE | NOT DEFERRABLE | INITIALLY DEFERRED | INITIALLY IMMEDIATE ]
|
||||
NOTICE: 'UNIQUE KEY' in table_constraint is only available in CENTRALIZED mode and B-format database!
|
||||
where table_constraint can be:
|
||||
[ CONSTRAINT [ constraint_name ] ]
|
||||
{ CHECK ( expression ) |
|
||||
|
|
@ -58,7 +66,8 @@ where index_parameters can be:
|
|||
where like_option can be:
|
||||
{ INCLUDING | EXCLUDING } { DEFAULTS | GENERATED | CONSTRAINTS | INDEXES | STORAGE | COMMENTS | RELOPTIONS | DISTRIBUTION | ALL }
|
||||
where partition_less_than_item can be:
|
||||
PARTITION partition_name VALUES LESS THAN ( { partition_value | MAXVALUE } ) [TABLESPACE tablespace_name]
|
||||
PARTITION partition_name VALUES LESS THAN { ( { partition_value | MAXVALUE } [, ... ] ) | MAXVALUE } [TABLESPACE [=] tablespace_name]
|
||||
NOTICE: MAXVALUE without parentheses is only available in B-format database!
|
||||
where partition_start_end_item can be:
|
||||
PARTITION partition_name {
|
||||
{START(partition_value) END (partition_value) EVERY (interval_value)} |
|
||||
|
|
@ -68,10 +77,12 @@ PARTITION partition_name {
|
|||
} [TABLESPACE tablespace_name]
|
||||
|
||||
NOTICE: '[ constraint_name ]' in table_constraint is optional in CENTRALIZED mode and B-format database, it is mandatory in other scenarios.
|
||||
NOTICE: '[ index_name ]' in table_constraint is only avaliable in CENTRALIZED mode and B-format database!
|
||||
NOTICE: '[ USING method ]' in table_constraint is only avaliable in CENTRALIZED mode and B-format database!
|
||||
NOTICE: '[ ASC | DESC ]' in table_constraint is only avaliable in CENTRALIZED mode and B-format database!
|
||||
NOTICE: 'AUTO_INCREMENT' is only avaliable in CENTRALIZED mode and B-format database!
|
||||
NOTICE: '[ index_name ]' in table_constraint is only available in CENTRALIZED mode and B-format database!
|
||||
NOTICE: '[ USING method ]' in table_constraint is only available in CENTRALIZED mode and B-format database!
|
||||
NOTICE: '[ ASC | DESC ]' in table_constraint is only available in CENTRALIZED mode and B-format database!
|
||||
NOTICE: 'AUTO_INCREMENT' is only available in CENTRALIZED mode and B-format database!
|
||||
NOTICE: '[ CHARACTER SET | CHARSET ]' is only available in CENTRALIZED mode and B-format database!
|
||||
NOTICE: '[ COLLATE [ = ] collation ]' is only available in CENTRALIZED mode and B-format database!
|
||||
</synopsis>
|
||||
</refsynopsisdiv>
|
||||
</refentry>
|
||||
|
|
|
|||
|
|
@ -11,23 +11,30 @@
|
|||
<refsynopsisdiv>
|
||||
<synopsis>
|
||||
CREATE TABLE [ IF NOT EXISTS ] subpartition_table_name
|
||||
( { column_name data_type [ COLLATE collation ] [ column_constraint [ ... ] ]
|
||||
( { column_name data_type [ CHARACTER SET | CHARSET charset ]
|
||||
[ COLLATE collation ] [ column_constraint [ ... ] ]
|
||||
| table_constraint
|
||||
| LIKE source_table [ like_option [...] ] }
|
||||
[, ... ]
|
||||
)
|
||||
[ AUTO_INCREMENT [ = ] value ]
|
||||
[ [ DEFAULT ] CHARACTER SET | CHARSET [ = ] charset ][ [ DEFAULT ] COLLATE [ = ] collation ]
|
||||
[ WITH ( {storage_parameter = value} [, ... ] ) ]
|
||||
[ COMPRESS | NOCOMPRESS ]
|
||||
[ TABLESPACE tablespace_name ]
|
||||
PARTITION BY {RANGE | LIST | HASH} (partition_key) SUBPARTITION BY {RANGE | LIST | HASH} (subpartition_key)
|
||||
PARTITION BY {RANGE [ COLUMNS ] | LIST [ COLUMNS ] | HASH | KEY} (partition_key) [ PARTITIONS integer ] SUBPARTITION BY {RANGE | LIST | HASH | KEY} (subpartition_key) [ SUBPARTITIONS integer ]
|
||||
(
|
||||
PARTITION partition_name1 [ VALUES LESS THAN (val1) | VALUES (val1[, ...]) ] [ TABLESPACE tablespace ]
|
||||
PARTITION partition_name1 [ VALUES LESS THAN { (val1 | MAXVALUE) | MAXVALUE } | VALUES [ IN ] (val1[, ...]) ] [ TABLESPACE [=] tablespace ]
|
||||
(
|
||||
{ SUBPARTITION subpartition_name1 [ VALUES LESS THAN (val1_1) | VALUES (val1_1[, ...])] [ TABLESPACE tablespace ] } [, ...]
|
||||
{ SUBPARTITION subpartition_name1 [ VALUES LESS THAN (val1_1) | VALUES (val1_1[, ...])] [ TABLESPACE [=] tablespace ] } [, ...]
|
||||
)
|
||||
[, ...]
|
||||
) [ { ENABLE | DISABLE } ROW MOVEMENT ];
|
||||
NOTICE: [ COLUMNS ] is only available in B-format database!
|
||||
NOTICE: [ PARTITIONS integer ] in RANGE/LIST partition is only available in B-format database!
|
||||
NOTICE: [ IN ] is only available in B-format database!
|
||||
NOTICE: KEY is only available in B-format database!
|
||||
NOTICE: MAXVALUE without parentheses is only available in B-format database!
|
||||
|
||||
where column_constraint can be:
|
||||
[ CONSTRAINT constraint_name ]
|
||||
|
|
@ -35,13 +42,14 @@ where column_constraint can be:
|
|||
NULL |
|
||||
CHECK ( expression ) |
|
||||
DEFAULT default_expr |
|
||||
GENERATED ALWAYS AS ( generation_expr ) STORED |
|
||||
GENERATED ALWAYS AS ( generation_expr ) [STORED] |
|
||||
AUTO_INCREMENT |
|
||||
UNIQUE index_parameters |
|
||||
UNIQUE [KEY] index_parameters |
|
||||
PRIMARY KEY index_parameters |
|
||||
REFERENCES reftable [ ( refcolumn ) ] [ MATCH FULL | MATCH PARTIAL | MATCH SIMPLE ]
|
||||
[ ON DELETE action ] [ ON UPDATE action ] }
|
||||
[ DEFERRABLE | NOT DEFERRABLE | INITIALLY DEFERRED | INITIALLY IMMEDIATE ]
|
||||
NOTICE: 'UNIQUE KEY' in table_constraint is only available in CENTRALIZED mode and B-format database!
|
||||
where table_constraint can be:
|
||||
[ CONSTRAINT [ constraint_name ] ]
|
||||
{ CHECK ( expression ) |
|
||||
|
|
@ -56,12 +64,14 @@ where index_parameters can be:
|
|||
[ WITH ( {storage_parameter = value} [, ... ] ) ]
|
||||
[ USING INDEX TABLESPACE tablespace_name ]
|
||||
|
||||
NOTICE: 'CREATE TABLE SUBPARTITION' is only avaliable in CENTRALIZED mode!
|
||||
NOTICE: 'CREATE TABLE SUBPARTITION' is only available in CENTRALIZED mode!
|
||||
NOTICE: '[ constraint_name ]' in table_constraint is optional in CENTRALIZED mode and B-format database, it is mandatory in other scenarios.
|
||||
NOTICE: '[ index_name ]' in table_constraint is only avaliable in CENTRALIZED mode and B-format database!
|
||||
NOTICE: '[ USING method ]' in table_constraint is only avaliable in CENTRALIZED mode and B-format database!
|
||||
NOTICE: '[ ASC | DESC ]' in table_constraint is only avaliable in CENTRALIZED mode and B-format database!
|
||||
NOTICE: 'AUTO_INCREMENT' is only avaliable in CENTRALIZED mode and B-format database!
|
||||
NOTICE: '[ index_name ]' in table_constraint is only available in CENTRALIZED mode and B-format database!
|
||||
NOTICE: '[ USING method ]' in table_constraint is only available in CENTRALIZED mode and B-format database!
|
||||
NOTICE: '[ ASC | DESC ]' in table_constraint is only available in CENTRALIZED mode and B-format database!
|
||||
NOTICE: 'AUTO_INCREMENT' is only available in CENTRALIZED mode and B-format database!
|
||||
NOTICE: '[ CHARACTER SET | CHARSET ]' is only available in CENTRALIZED mode and B-format database!
|
||||
NOTICE: '[ COLLATE [ = ] collation ]' is only available in CENTRALIZED mode and B-format database!
|
||||
</synopsis>
|
||||
</refsynopsisdiv>
|
||||
</refentry>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
<refentry id="SQL-DROPEVENTTRIGGER">
|
||||
<refmeta>
|
||||
<refentrytitle>DROP EVENT TRIGGER</refentrytitle>
|
||||
<manvolnum>7</manvolnum>
|
||||
<refmiscinfo>SQL - Language Statements</refmiscinfo>
|
||||
</refmeta>
|
||||
<refnamediv>
|
||||
<refname>DROP EVENT TRIGGER</refname>
|
||||
<refpurpose>remove an event trigger</refpurpose>
|
||||
</refnamediv>
|
||||
<refsynopsisdiv>
|
||||
<indexterm zone="sql-dropeventtrigger">
|
||||
<primary>DROP EVENT TRIGGER</primary>
|
||||
</indexterm>
|
||||
<refsynopsisdiv>
|
||||
<synopsis>
|
||||
DROP EVENT TRIGGER [ IF EXISTS ] name [ CASCADE | RESTRICT ]
|
||||
</synopsis>
|
||||
</refsynopsisdiv>
|
||||
</refentry>
|
||||
|
|
@ -13,6 +13,7 @@
|
|||
[ WITH [ RECURSIVE ] with_query [, ...] ]
|
||||
SELECT [/*+ plan_hint */] [ ALL | DISTINCT [ ON ( expression [, ...] ) ] ]
|
||||
{ * | {expression [ [ AS ] output_name ]} [, ...] }
|
||||
[into_option]
|
||||
[ FROM from_item [, ...] ]
|
||||
[ WHERE condition ]
|
||||
[ [ START WITH condition ] CONNECT BY condition [ ORDER SIBLINGS BY expression ] ]
|
||||
|
|
@ -24,9 +25,27 @@ SELECT [/*+ plan_hint */] [ ALL | DISTINCT [ ON ( expression [, ...] ) ] ]
|
|||
[ LIMIT { [offset,] count | ALL } ]
|
||||
[ OFFSET start [ ROW | ROWS ] ]
|
||||
[ FETCH { FIRST | NEXT } [ count ] { ROW | ROWS } ONLY ]
|
||||
[into_option]
|
||||
[ {FOR { UPDATE | NO KEY UPDATE | SHARE | KEY SHARE } [ OF table_name [, ...] ] [ NOWAIT | WAIT N | SKIP LOCKED]} [...] ]
|
||||
[into_option]
|
||||
TABLE { ONLY { (table_name) | table_name } | table_name [ * ]};
|
||||
|
||||
where into_option can be:
|
||||
INTO var_name [, var_name] ...
|
||||
| INTO OUTFILE 'file_name'
|
||||
[CHARACTER SET charset_name]
|
||||
export_options
|
||||
| INTO DUMPFILE 'file_name'
|
||||
where export_options can be:
|
||||
[FIELDS
|
||||
[TERMINATED BY 'string']
|
||||
[[OPTIONALLY] ENCLOSED BY 'char']
|
||||
[ESCAPED BY 'char' ]
|
||||
]
|
||||
[LINES
|
||||
[STARTING BY 'string']
|
||||
[TERMINATED BY 'string']
|
||||
]
|
||||
where from_item can be:
|
||||
[ ONLY ] table_name [ * ] [ partition_clause ] [ [ AS ] alias [ ( column_alias [, ...] ) ] ]
|
||||
[ TABLESAMPLE sampling_method ( argument [, ...] ) [ REPEATABLE ( seed ) ] ]
|
||||
|
|
@ -50,6 +69,7 @@ PARTITION { ( partition_name ) | FOR ( partition_value [, ...] ) }
|
|||
SUBPARTITION { ( subpartition_name ) | FOR ( subpartition_value [, ...] )}
|
||||
where nlssort_expression_clause can be:
|
||||
NLSSORT ( column_name, ' NLS_SORT = { SCHINESE_PINYIN_M | generic_m_ci } ' )
|
||||
NOTICE: [into_option] is only available in CENTRALIZED mode and B-format database.
|
||||
NOTICE: '[ [ START WITH condition ] CONNECT BY condition [ ORDER SIBLINGS BY expression ] ]' is only avaliable in CENTRALIZED mode!
|
||||
NOTICE: 'SUBPARTITION { ( subpartition_name ) | FOR ( subpartition_value [, ...] )}' is only avaliable in CENTRALIZED mode!
|
||||
</synopsis>
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ SET [ SESSION | @@SESSION. | @@]
|
|||
{ {config_parameter = { expr | DEFAULT }}};
|
||||
SET @var_name := expr [, @var_name := expr] ...
|
||||
SET @var_name = expr [, @var_name = expr] ...
|
||||
NOTICE: '@var_name','{ GLOBAL | @@GLOBAL.}', '[ SESSION | @@SESSION. | @@]' are only avaiable in CENTRALIZED mode and B-format database, and enable_set_variable_b_format = on.
|
||||
NOTICE: '@var_name' are only available in CENTRALIZED mode and B-format database.
|
||||
NOTICE: '{ GLOBAL | @@GLOBAL.}' are only available in CENTRALIZED mode and B-format database.
|
||||
NOTICE: '[ @@SESSION. | @@]' are only available in CENTRALIZED mode and B-format database.
|
||||
</synopsis>
|
||||
</refsynopsisdiv>
|
||||
|
|
@ -10,11 +10,12 @@
|
|||
</refnamediv>
|
||||
<refsynopsisdiv>
|
||||
<synopsis>
|
||||
{SET [ LOCAL ] TRANSACTION|SET SESSION CHARACTERISTICS AS TRANSACTION}
|
||||
{SET [ LOCAL | SESSION | GLOBAL ] TRANSACTION|SET SESSION CHARACTERISTICS AS TRANSACTION}
|
||||
{ ISOLATION LEVEL { READ COMMITTED | READ UNCOMMITTED }
|
||||
| { READ WRITE | READ ONLY | SERIALIZABLE | REPEATABLE READ }
|
||||
} [, ...]
|
||||
SET TRANSACTION SNAPSHOT snapshot_id;
|
||||
NOTICE: SET GLOBAL TRANSACTION is only available in CENTRALIZED mode and B-format database!
|
||||
</synopsis>
|
||||
</refsynopsisdiv>
|
||||
</refentry>
|
||||
|
|
@ -310,7 +310,7 @@ docker_temp_server_start() {
|
|||
|
||||
# internal start of server in order to allow setup using gsql client
|
||||
# does not listen on external TCP/IP and waits until start finishes
|
||||
set -- "$@" -c listen_addresses='' -p "${PGPORT:-5432}"
|
||||
set -- "$@" -c "listen_addresses='*'" -p "${PGPORT:-5432}"
|
||||
|
||||
PGUSER="${PGUSER:-$GS_USER}" \
|
||||
gs_ctl -D "$PGDATA" \
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
容器化升级操作指南
|
||||
前置条件:
|
||||
旧版本容器集群状态正常
|
||||
容器化升级操作步骤:
|
||||
1. 准备升级工具、新版本容器和包
|
||||
(1) 新版本容器镜像需载入到环境
|
||||
(2) 将升级工具和新版本包放入升级路径
|
||||
相关路径说明:
|
||||
GAUSSDATA:数据库数据目录,默认为/var/lib/opengauss/data,升级工具中可以通过-D指定
|
||||
GAUSS_UPGRADE_BASE_PATH:升级根路径,默认为$GAUSSDATA/upgrade,升级工具中可以通过-B指定
|
||||
UPGRADE_NEW_PKG_PATH:新包路径,默认为$GAUSS_UPGRADE_BASE_PATH/pkg_new,升级工具中可以通过-N指定
|
||||
新版本包中必须包含version.cfg、upgrade_sql.tar.gz和upgrade_sql.sha256
|
||||
2. 在**所有旧版本主备机容器**中执行前置升级动作
|
||||
sh upgrade.sh -t upgrade_pre
|
||||
3. 停掉所有旧版本库
|
||||
4. 启动所有新版本库并在所有新版本主备机容器中执行upgrade_bin、upgrade_post和upgrade_commit动作
|
||||
sh upgrade.sh -t upgrade_bin
|
||||
sh upgrade.sh -t upgrade_post
|
||||
sh upgrade.sh -t upgrade_commit
|
||||
|
||||
回退操作步骤:
|
||||
case 1: 已切换到新二进制
|
||||
sh upgrade.sh -t rollback_post (已执行upgrade_post动作)
|
||||
sh upgrade.sh -t rollback_bin (已执行upgrade_bin动作)
|
||||
退出新版本容器
|
||||
|
||||
case 2: 仅执行了upgrade_pre动作
|
||||
sh upgrade.sh -t rollback_pre
|
||||
|
||||
**注意:**
|
||||
如果升级路径和新包路径自行规划,则需要在新旧容器中做着两个路径的卷映射
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
#!/bin/bash
|
||||
# Copyright (c) Huawei Technologies Co., Ltd. 2010-2022. All rights reserved.
|
||||
# date: 2021-12-22
|
||||
# version: 1.0
|
||||
|
||||
CURRENT_DIR=$(
|
||||
cd $(dirname $0)
|
||||
pwd
|
||||
)
|
||||
|
||||
source ${CURRENT_DIR}/upgrade_common.sh
|
||||
|
||||
function main() {
|
||||
parse_cmd_line $@
|
||||
init_config
|
||||
check_and_init
|
||||
case "${action}" in
|
||||
upgrade_pre)
|
||||
upgrade_pre
|
||||
exit 0
|
||||
;;
|
||||
upgrade_bin)
|
||||
upgrade_bin
|
||||
exit 0
|
||||
;;
|
||||
upgrade_post)
|
||||
upgrade_post
|
||||
exit 0
|
||||
;;
|
||||
rollback_pre)
|
||||
rollback_pre
|
||||
exit 0
|
||||
;;
|
||||
rollback_bin)
|
||||
rollback_bin
|
||||
exit 0
|
||||
;;
|
||||
rollback_post)
|
||||
rollback_post
|
||||
exit 0
|
||||
;;
|
||||
upgrade_commit)
|
||||
upgrade_commit
|
||||
exit 0
|
||||
;;
|
||||
query_start_mode)
|
||||
query_start_mode
|
||||
exit 0
|
||||
;;
|
||||
switch_over)
|
||||
switch_over
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
log "please input right parameter, the following command may help you"
|
||||
log "sh upgrade_GAUSSV5.sh --help or sh upgrade_GAUSSV5.sh -h"
|
||||
die "Must input parameter -t action" ${err_parameter}
|
||||
;;
|
||||
esac
|
||||
}
|
||||
main $@
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,18 @@
|
|||
#!/bin/bash
|
||||
# Copyright (c) Huawei Technologies Co., Ltd. 2010-2022. All rights reserved.
|
||||
# date: 2021-12-22
|
||||
# version: 1.0
|
||||
|
||||
err_upgrade_pre=201
|
||||
err_upgrade_bin=202
|
||||
err_upgrade_post=203
|
||||
err_rollback_pre=204
|
||||
err_rollback_bin=205
|
||||
err_rollback_post=206
|
||||
err_check_init=207
|
||||
err_parameter=208
|
||||
err_upgrade_commit=209
|
||||
err_version_same=210
|
||||
err_no_need_commit=211
|
||||
err_inner_sys=212
|
||||
err_dn_role_null=213
|
||||
|
|
@ -0,0 +1 @@
|
|||
Subproject commit f2a09ee9e98b3c0ed1ec26da6f1c3ddacece41b1
|
||||
|
|
@ -0,0 +1 @@
|
|||
Subproject commit ba09836e0bb59243426a28b79c260570ec87e78e
|
||||
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 5c3a84bd0c656ef7529a8fcd806e07f24560b415
|
||||
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 22959853b32c2653c6dc663fb236329680847ed6
|
||||
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 26e5d6310154258393807b95336c04b2eda991ce
|
||||
|
|
@ -0,0 +1 @@
|
|||
Subproject commit a8f2377a242dbdb6a8366738c85d365bef478477
|
||||
|
|
@ -0,0 +1 @@
|
|||
Subproject commit d037643b5dfb030eb8b0da4ecb22b0bd6a51a8b1
|
||||
|
|
@ -0,0 +1 @@
|
|||
Subproject commit f7a9a3b2e2c28a4f045a857debcaea372273826d
|
||||
|
|
@ -88,11 +88,19 @@ function check_install_env() {
|
|||
fi
|
||||
|
||||
# check pid port and lock file
|
||||
port_occupied=$(netstat -ntul | grep $port)
|
||||
if [ X"$port_occupied" != X"" ]; then
|
||||
error "Error: The port $port has been occupied, please use -p to set a new port."
|
||||
exit 1
|
||||
fi
|
||||
portlist=($(netstat -nutl | grep $port))
|
||||
i=3
|
||||
while ((i < ${#portlist[*]}))
|
||||
do
|
||||
listen_addr=${portlist[((i))]}
|
||||
p=${listen_addr##*:}
|
||||
echo $p
|
||||
if [ X"$p" == X"$port" ]; then
|
||||
error "Error: The port $port has been occupied, please use -p to set a new port."
|
||||
exit 1
|
||||
fi
|
||||
((i += 6))
|
||||
done
|
||||
|
||||
local delete_slave_lock=""
|
||||
local delete_master_lock=""
|
||||
|
|
|
|||
|
|
@ -86,7 +86,6 @@
|
|||
/common/backend/utils/misc/guc-file.cpp
|
||||
/common/backend/utils/pg_builtin_proc.h
|
||||
/common/backend/utils/probes.h
|
||||
/common/backend/utils/sort/qsort_tuple.cpp
|
||||
/common/interfaces/ecpg/compatlib/exports.list
|
||||
/common/interfaces/ecpg/ecpglib/exports.list
|
||||
/common/interfaces/ecpg/ecpglib/path.cpp
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ endif()
|
|||
if("${ENABLE_MULTIPLE_NODES}" STREQUAL "OFF")
|
||||
install(DIRECTORY ${DCF_LIB_PATH} DESTINATION .)
|
||||
endif()
|
||||
if(${ENABLE_MULTIPLE_NODES}_${ENABLE_PRIVATEGAUSS} STREQUAL OFF_OFF)
|
||||
if(${ENABLE_MULTIPLE_NODES}_${ENABLE_PRIVATEGAUSS} STREQUAL OFF_OFF AND NOT ${ENABLE_LITE_MODE} STREQUAL ON)
|
||||
if(EXISTS ${DMS_LIB_PATH})
|
||||
install(DIRECTORY ${DMS_LIB_PATH} DESTINATION .)
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -211,6 +211,7 @@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@
|
|||
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
|
||||
PTHREAD_LIBS = @PTHREAD_LIBS@
|
||||
with_openeuler_os = @with_openeuler_os@
|
||||
with_openeuler_major = @with_openeuler_major@
|
||||
|
||||
|
||||
#############################################################################
|
||||
|
|
@ -728,6 +729,11 @@ endif
|
|||
ifeq ($(with_openeuler_os), yes)
|
||||
override CPPFLAGS := $(CPPFLAGS) -DWITH_OPENEULER_OS
|
||||
endif
|
||||
|
||||
ifeq ($(with_openeuler_major), yes)
|
||||
override CPPFLAGS := $(CPPFLAGS) -DOPENEULER_MAJOR
|
||||
endif
|
||||
|
||||
CC = @CC@
|
||||
GCC = @GCC@
|
||||
C = gcc
|
||||
|
|
|
|||
|
|
@ -69,3 +69,11 @@ endif
|
|||
|
||||
$(recurse)
|
||||
$(recurse_always)
|
||||
|
||||
# psql and pg_dump need to make subtarget: libpq-ce, if these two targets make parallel, it
|
||||
# may cause frontend_parser/gram.o: file not recognized: file truncated.
|
||||
# I'm not sure why this happen, and since we use $(recurse) to make install and make all.
|
||||
# I have no idea how to forbide psql and pg_dump to make parallel.
|
||||
# So try to use NOTPARALLEL to avoid make parallel in this makefile. This will forbide all
|
||||
# SUBDIRS make in parallel, which will decrease the compile speed...
|
||||
.NOTPARALLEL:
|
||||
|
|
@ -58,10 +58,13 @@ audit_resource_policy|bool|0,0|NULL|NULL|
|
|||
audit_rotation_interval|int|1,35791394|min|NULL|
|
||||
audit_rotation_size|int|1024,1048576|kB|NULL|
|
||||
audit_space_limit|int|1024,1073741824|kB|NULL|
|
||||
audit_system_object|int|0,134217727|NULL|NULL|
|
||||
audit_system_object|int|0,268435455|NULL|NULL|
|
||||
audit_user_locked|int|0,1|NULL|NULL|
|
||||
audit_user_violation|int|0,1|NULL|NULL|
|
||||
audit_set_parameter|int|0,1|NULL|NULL|
|
||||
no_audit_client|string|0,0|NULL|NULL|
|
||||
full_audit_users|string|0,0|NULL|NULL|
|
||||
audit_system_function_exec|int|0,1|NULL|NULL|
|
||||
authentication_timeout|int|1,600|s|NULL|
|
||||
autoanalyze|bool|0,0|NULL|NULL|
|
||||
autovacuum|bool|0,0|NULL|Even if this parameter is set to off, when a transaction ID wraparound imminent, the database will automatically start the cleanup process automatically.|
|
||||
|
|
@ -82,6 +85,7 @@ backslash_quote|enum|safe_encoding,on,off,true,false,yes,no,1,0|NULL|NULL|
|
|||
backtrace_min_messages|enum|debug,debug5,debug4,debug3,debug2,debug1,log,info,notice,warning,error,fatal,panic|NULL|It will increase the cost of the system, when print the function stack information frequently. Therefore, when analyzing the problem, avoid setting the value of backtrace_min_messages for fatal following levels.|
|
||||
bbox_dump_count|int|1,20|NULL|NULL|
|
||||
bbox_dump_path|string|0,0|NULL|NULL|
|
||||
b_format_behavior_compat_options|string|0,0|NULL|NULL|
|
||||
behavior_compat_options|string|0,0|NULL|NULL|
|
||||
plsql_compile_check_options|string|0,0|NULL|NULL|
|
||||
bgwriter_delay|int|10,10000|ms|NULL|
|
||||
|
|
@ -153,6 +157,7 @@ instr_unique_sql_count|int|0,2147483647|NULL|NULL|
|
|||
track_stmt_session_slot|int|0,2147483647|NULL|NULL|
|
||||
track_stmt_details_size|int64|0,100000000|NULL|NULL|
|
||||
track_stmt_stat_level|string|0,0|NULL|NULL|
|
||||
enable_availablezone|bool|0,0|NULL|NULL|
|
||||
enable_instr_cpu_timer|bool|0,0|NULL|NULL|
|
||||
enable_instr_rt_percentile|bool|0,0|NULL|NULL|
|
||||
enable_instr_track_wait|bool|0,0|NULL|NULL|
|
||||
|
|
@ -170,6 +175,7 @@ enable_codegen_print|bool|0,0|NULL|Enable dump for llvm function|
|
|||
enable_delta_store|bool|0,0|NULL|NULL|
|
||||
enable_default_cfunc_libpath|bool|0,0|NULL|NULL|
|
||||
enable_defer_calculate_snapshot|bool|0,0|NULL|NULL|
|
||||
enable_expr_fusion|bool|0,0|NULL|NULL|
|
||||
codegen_cost_threshold|int|0,2147483647|NULL|Decided to use LLVM optimization or not|
|
||||
codegen_strategy|enum|partial,pure|NULL|NULL|
|
||||
enable_compress_spill|bool|0,0|NULL|NULL|
|
||||
|
|
@ -194,6 +200,7 @@ enable_hdfs_predicate_pushdown|bool|0,0|NULL|NULL|
|
|||
enable_hypo_index|bool|0,0|NULL|NULL|
|
||||
enable_indexonlyscan|bool|0,0|NULL|NULL|
|
||||
enable_indexscan|bool|0,0|NULL|NULL|
|
||||
enable_inner_unique_opt|bool|0,0|NULL|NULL|
|
||||
enable_kill_query|bool|0,0|NULL|NULL|
|
||||
enable_material|bool|0,0|NULL|NULL|
|
||||
enable_memory_limit|bool|0,0|NULL|NULL|
|
||||
|
|
@ -438,7 +445,7 @@ ha_module_debug|bool|0,0|NULL|NULL|
|
|||
require_ssl|bool|0,0|NULL|NULL|
|
||||
resource_track_log|enum|summary,detail|NULL|NULL|
|
||||
restart_after_crash|bool|0,0|NULL|NULL|
|
||||
rewrite_rule|enum|lazyagg,magicset,partialpush,uniquecheck,disablerep,intargetlist,predpush,predpushforce,predpushnormal,disable_pullup_expr_sublink,none|NULL|NULL|
|
||||
rewrite_rule|enum|lazyagg,magicset,partialpush,uniquecheck,disablerep,intargetlist,predpush,predpushforce,predpushnormal,disable_pullup_expr_sublink,enable_sublink_pullup_enhanced,none|NULL|NULL|
|
||||
safe_data_path|string|0,0|NULL|NULL|
|
||||
search_path|string|0,0|NULL|NULL|
|
||||
session_replication_role|enum|origin,replica,local|NULL|When this parameter is set, any cached query plan will be lost before.|
|
||||
|
|
@ -672,6 +679,7 @@ sql_beta_feature|enum|partition_fdw_on,partition_opfusion,index_cost_with_leaf_p
|
|||
partition_iterator_elimination|bool|0,0|NULL|NULL|
|
||||
enable_functional_dependency|bool|0,0|NULL|NULL|
|
||||
enable_seqscan_fusion|bool|0,0|NULL|NULL|
|
||||
enable_indexscan_optimization|bool|0,0|NULL|NULL|
|
||||
max_logical_replication_workers|int|0,262143|NULL|Maximum number of logical replication worker processes.|
|
||||
max_sync_workers_per_subscription|int|0,262143|NULL|Maximum number of table synchronization workers per subscription.|
|
||||
walwriter_sleep_threshold|int64|1,50000|NULL|NULL|
|
||||
|
|
@ -705,12 +713,14 @@ ss_enable_dms|bool|0,0|NULL|NULL|
|
|||
ss_enable_catalog_centralized|bool|0,0|NULL|NULL|
|
||||
ss_enable_reform|bool|0,0|NULL|NULL|
|
||||
ss_enable_ssl|bool|0,0|NULL|NULL|
|
||||
ss_enable_log_level|bool|0,0|NULL|NULL|
|
||||
ss_enable_aio|bool|0,0|NULL|NULL|
|
||||
ss_interconnect_channel_count|int|1,32|NULL|NULL|
|
||||
ss_work_thread_count|int|16,128|NULL|NULL|
|
||||
ss_recv_msg_pool_size|int|1024,1048576|kB|NULL|
|
||||
ss_interconnect_type|string|0,0|NULL|NULL|
|
||||
ss_log_level|int|0,887|NULL|NULL|
|
||||
ss_log_backup_file_count|int|0,1024|NULL|NULL|
|
||||
ss_log_max_file_size|int|1024,4194304|kB|NULL|
|
||||
ss_instance_id|int|0,63|NULL|NULL|
|
||||
ss_interconnect_url|string|0,0|NULL|NULL|
|
||||
ss_rdma_work_config|string|0,0|NULL|NULL|
|
||||
|
|
@ -723,6 +733,8 @@ ss_scrlock_worker_bind_core|string|0,0|NULL|NULL|
|
|||
ss_scrlock_server_bind_core|string|0,0|NULL|NULL|
|
||||
dolphin_server_port|int|1024,65535|NULL|NULL|
|
||||
enable_dolphin_proto|bool|0,0|NULL|NULL|
|
||||
enable_remote_excute|bool|0,0|NULL|NULL|
|
||||
light_comm|bool|0,0|NULL|NULL|
|
||||
[cmserver]
|
||||
log_dir|string|0,0|NULL|NULL|
|
||||
log_file_size|int|0,2047|MB|NULL|
|
||||
|
|
|
|||
|
|
@ -1093,6 +1093,63 @@ int validate_node_instance_name(char* nodename, int type, char* instance_name)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef ENABLE_MULTIPLE_NODES
|
||||
/*
|
||||
******************************************************************************
|
||||
Function : gsguc_precheck_forbid_parameters
|
||||
Description : Forbid reload/set/check GUC parameters in list for ALL node type
|
||||
Input : nodename(indicates node name)
|
||||
Output : none
|
||||
Return : bool
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Forbid parameters for method "reload" with "all" nodes */
|
||||
char *gsguc_forbid_list_reload[] = {
|
||||
"listen_addresses",
|
||||
NULL
|
||||
};
|
||||
|
||||
bool gsguc_precheck_forbid_parameters(char *nodename)
|
||||
{
|
||||
/* If set pg_hba, just pass */
|
||||
if (is_hba_conf) {
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (ctl_command) {
|
||||
case SET_CONF_COMMAND:
|
||||
/* process checking parameters for SET mode */
|
||||
break;
|
||||
case RELOAD_CONF_COMMAND:
|
||||
/* process checking parameters for RELOAD mode */
|
||||
if (strncmp(nodename, "all", strlen("all")) != 0) {
|
||||
break;
|
||||
}
|
||||
/* parameters not support '-N all' */
|
||||
for (int i = 0; i < config_param_number && config_param[i] != NULL; i++) {
|
||||
for (int j = 0; gsguc_forbid_list_reload[j] != NULL; j++) {
|
||||
if (strcmp(config_param[i], gsguc_forbid_list_reload[j]) == 0) {
|
||||
write_stderr(_("ERROR: \"%s\" can not \"%s\" with \"%s\" method.\n"),
|
||||
gsguc_forbid_list_reload[j],
|
||||
get_ctl_command_type(),
|
||||
nodename);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CHECK_CONF_COMMAND:
|
||||
/* process checking parameters for CHECK mode */
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
Function : validate_cluster_guc_options
|
||||
|
|
@ -1371,10 +1428,16 @@ void process_cluster_guc_option(char* nodename, int type, char* instance_name, c
|
|||
}
|
||||
else
|
||||
{
|
||||
if (0 == strncmp(nodename, "all", sizeof("all")))
|
||||
if (0 == strncmp(nodename, "all", strlen("all"))) {
|
||||
#ifndef ENABLE_MULTIPLE_NODES
|
||||
if (!gsguc_precheck_forbid_parameters(nodename)) {
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
do_all_nodes_instance(instance_name, indatadir);
|
||||
else
|
||||
} else {
|
||||
do_remote_instance(nodename, instance_name, indatadir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2634,6 +2634,8 @@ int main(int argc, char** argv)
|
|||
char* pgdata_C = NULL;
|
||||
char* nodename = NULL;
|
||||
char* instance_name = NULL;
|
||||
int nodeNum = 0;
|
||||
int instanceNum = 0;
|
||||
int nRet = 0;
|
||||
errno_t rc = 0;
|
||||
progname = PROG_NAME;
|
||||
|
|
@ -2753,11 +2755,13 @@ int main(int argc, char** argv)
|
|||
case 'N': {
|
||||
GS_FREE(nodename);
|
||||
nodename = xstrdup(optarg);
|
||||
nodeNum++;
|
||||
break;
|
||||
}
|
||||
case 'I': {
|
||||
GS_FREE(instance_name);
|
||||
instance_name = xstrdup(optarg);
|
||||
instanceNum++;
|
||||
break;
|
||||
}
|
||||
case 'M': {
|
||||
|
|
@ -2909,6 +2913,11 @@ int main(int argc, char** argv)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (nodeNum > 1 || instanceNum > 1) {
|
||||
write_stderr(_("ERROR: The number of -I or -N must less than 2.\n"));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (false == allocate_memory_list()) {
|
||||
write_stderr(_("ERROR: Failed to allocate memory to list.\n"));
|
||||
exit(1);
|
||||
|
|
|
|||
|
|
@ -584,6 +584,15 @@ function check_param_exists()
|
|||
unique_params[$param_name]="true"
|
||||
}
|
||||
|
||||
function isValidPort()
|
||||
{
|
||||
string=$1
|
||||
if [[ ! $string =~ ^[0-9]+$ ]]; then
|
||||
echo "ERROR: '"$string"' is not a valid port number"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function parse_cmd_params()
|
||||
{
|
||||
while [[ $# -gt 0 ]]; do
|
||||
|
|
@ -603,12 +612,14 @@ function parse_cmd_params()
|
|||
port=*)
|
||||
check_param_exists "port"
|
||||
cmd_param_port=$(get_value $1)
|
||||
isValidPort $cmd_param_port
|
||||
shift # past value
|
||||
;;
|
||||
-p)
|
||||
check_param_exists "port"
|
||||
shift
|
||||
cmd_param_port=$1
|
||||
isValidPort $cmd_param_port
|
||||
shift
|
||||
;;
|
||||
user=*)
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ function logo()
|
|||
echo " | | | | (_| | | | | ____) | | | | | | | |_| | | (_| | || (_) | | "
|
||||
echo " |_| |_|\__,_|_| |_| |_____/|_|_| |_| |_|\__,_|_|\__,_|\__|___/|_| "
|
||||
echo " "
|
||||
echo " Version 3.1.0"
|
||||
echo " Version 5.0.0"
|
||||
echo "--------------------------------------------------------------------------"
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3797,7 +3797,9 @@ static void usage(const char* prog_name)
|
|||
#ifndef ENABLE_MULTIPLE_NODES
|
||||
printf(_(" -c, --enable-dcf enable DCF mode\n"));
|
||||
#endif
|
||||
#ifndef ENABLE_LITE_MODE
|
||||
printf(_(" --enable-dss enable shared storage mode\n"));
|
||||
#endif
|
||||
printf(_(" [-D, --pgdata=]DATADIR location for this database cluster\n"));
|
||||
#ifdef ENABLE_MULTIPLE_NODES
|
||||
printf(_(" --nodename=NODENAME name of openGauss node initialized\n"));
|
||||
|
|
@ -3805,9 +3807,12 @@ static void usage(const char* prog_name)
|
|||
#else
|
||||
printf(_(" --nodename=NODENAME name of single node initialized\n"));
|
||||
#endif
|
||||
#ifndef ENABLE_LITE_MODE
|
||||
printf(_(" --vgname=VGNAME name of dss volume group\n"));
|
||||
printf(_(" --socketpath=SOCKETPATH\n"
|
||||
" dss connect socket file path\n"));
|
||||
printf(_(" --dms_url=URL message communication url between nodes\n"));
|
||||
#endif
|
||||
printf(_(" -E, --encoding=ENCODING set default encoding for new databases\n"));
|
||||
printf(_(" --locale=LOCALE set default locale for new databases\n"));
|
||||
printf(_(" --dbcompatibility=DBCOMPATIBILITY set default dbcompatibility for new database\n"));
|
||||
|
|
@ -3891,6 +3896,7 @@ static bool is_file_exist(const char* path)
|
|||
return isExist;
|
||||
}
|
||||
|
||||
#ifndef ENABLE_LITE_MODE
|
||||
static void parse_vgname_args(char* args)
|
||||
{
|
||||
vgname = xstrdup(args);
|
||||
|
|
@ -3920,6 +3926,7 @@ static void parse_vgname_args(char* args)
|
|||
exit(1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
|
@ -4198,7 +4205,7 @@ int main(int argc, char* argv[])
|
|||
break;
|
||||
case 8:
|
||||
FREE_NOT_STATIC_ZERO_STRING(locale);
|
||||
locale = "C";
|
||||
locale = xstrdup("C");
|
||||
break;
|
||||
case 9:
|
||||
FREE_NOT_STATIC_ZERO_STRING(pwfilename);
|
||||
|
|
@ -4255,6 +4262,7 @@ int main(int argc, char* argv[])
|
|||
}
|
||||
g_bucket_len = atoi(optarg);
|
||||
break;
|
||||
#ifndef ENABLE_LITE_MODE
|
||||
case 15:
|
||||
FREE_NOT_STATIC_ZERO_STRING(vgname);
|
||||
FREE_NOT_STATIC_ZERO_STRING(vgdata);
|
||||
|
|
@ -4274,6 +4282,7 @@ int main(int argc, char* argv[])
|
|||
check_input_spec_char(optarg);
|
||||
ss_nodedatainfo = xstrdup(optarg);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
/* getopt_long already emitted a complaint */
|
||||
write_stderr(_("Try \"%s --help\" for more information.\n"), progname);
|
||||
|
|
|
|||
|
|
@ -153,6 +153,17 @@ static void TablespaceValueCheck(TablespaceListCell* cell, const char* arg)
|
|||
}
|
||||
}
|
||||
|
||||
static void isPortNumber(const char *portarg)
|
||||
{
|
||||
int len = strlen(portarg);
|
||||
for (int i = 0; i < len; i++) {
|
||||
if (!(portarg[i] >= '0' && portarg[i] <= '9')) {
|
||||
fprintf(stderr, _("invalid port number \"%s\"\n"), portarg);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Split argument into old_dir and new_dir and append to tablespace mapping
|
||||
* list.
|
||||
|
|
@ -268,6 +279,8 @@ static void GsTarUsage(void)
|
|||
printf(_("\nOptions controlling the output:\n"));
|
||||
printf(_(" -D, --destination=DIRECTORY untar files into directory\n"));
|
||||
printf(_(" -F, --filename=FILENAME filename to be untar\n"));
|
||||
printf(_(" -V, --version output version information, then exit\n"));
|
||||
printf(_(" -?, --help show this help, then exit\n"));
|
||||
}
|
||||
|
||||
static void tablespace_list_create()
|
||||
|
|
@ -1141,8 +1154,6 @@ static void BaseBackup(void)
|
|||
/* Error message already written in GetConnection() */
|
||||
exit(1);
|
||||
|
||||
ClearAndFreePasswd();
|
||||
|
||||
/*
|
||||
* Run IDENTIFY_SYSTEM so we can get the timeline
|
||||
*/
|
||||
|
|
@ -1322,6 +1333,7 @@ static void BaseBackup(void)
|
|||
StartLogStreamer((const char *)xlogstart, timeline, sysidentifier);
|
||||
}
|
||||
|
||||
ClearAndFreePasswd();
|
||||
/* free sysidentifier after use */
|
||||
PQfreemem(sysidentifier);
|
||||
sysidentifier = NULL;
|
||||
|
|
@ -1572,7 +1584,7 @@ static void GsTarHelp(int argc, char** argv) {
|
|||
GsTarUsage();
|
||||
exit(0);
|
||||
} else if (strcmp(argv[1], "-V") == 0 || strcmp(argv[1], "--version") == 0) {
|
||||
puts("gs_basebackup " DEF_GS_VERSION);
|
||||
puts("gs_tar " DEF_GS_VERSION);
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
|
@ -1923,6 +1935,46 @@ static int GsBaseBackup(int argc, char** argv)
|
|||
}
|
||||
}
|
||||
|
||||
char optstring[] = "D:l:c:h:p:U:s:X:F:T:Z:t:wWvPxz";
|
||||
/* check if a required_argument option has a void argument */
|
||||
int i;
|
||||
for (i = 0; i < argc; i++) {
|
||||
char *optstr = argv[i];
|
||||
int is_only_shortbar;
|
||||
if (strlen(optstr) == 1) {
|
||||
is_only_shortbar = optstr[0] == '-' ? 1 : 0;
|
||||
} else {
|
||||
is_only_shortbar = 0;
|
||||
}
|
||||
if (is_only_shortbar) {
|
||||
fprintf(stderr, _("%s: The option '-' is not a valid option.\n"), progname);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
char *oli = strchr(optstring, optstr[1]);
|
||||
int is_shortopt_with_space;
|
||||
if (oli != NULL && strlen(optstr) >= 1 && strlen(oli) >= 2) {
|
||||
is_shortopt_with_space =
|
||||
optstr[0] == '-' && oli != NULL && oli[1] == ':' && oli[2] != ':' && optstr[2] == '\0';
|
||||
} else {
|
||||
is_shortopt_with_space = 0;
|
||||
}
|
||||
if (is_shortopt_with_space) {
|
||||
if (i == argc - 1) {
|
||||
fprintf(stderr, _("%s: The option '-%c' need a parameter.\n"), progname, optstr[1]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
char *next_optstr = argv[i + 1];
|
||||
char *next_oli = strchr(optstring, next_optstr[1]);
|
||||
int is_arg_optionform = next_optstr[0] == '-' && next_oli != NULL;
|
||||
if (is_arg_optionform) {
|
||||
fprintf(stderr, _("%s: The option '-%c' need a parameter.\n"), progname, optstr[1]);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
while ((c = getopt_long(argc, argv, "D:l:c:h:p:U:s:X:F:T:Z:t:wWvPxz", long_options, &option_index)) != -1) {
|
||||
switch (c) {
|
||||
case 'D': {
|
||||
|
|
@ -2017,6 +2069,7 @@ static int GsBaseBackup(int argc, char** argv)
|
|||
case 'p':
|
||||
GS_FREE(dbport);
|
||||
check_env_value_c(optarg);
|
||||
isPortNumber(optarg);
|
||||
dbport = inc_dbport(optarg);
|
||||
break;
|
||||
case 'U':
|
||||
|
|
@ -2060,7 +2113,7 @@ static int GsBaseBackup(int argc, char** argv)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* If port is not specified by using -p, obtain the port through environment variables */
|
||||
if (dbport == NULL) {
|
||||
char *value = NULL;
|
||||
|
|
@ -2071,6 +2124,7 @@ static int GsBaseBackup(int argc, char** argv)
|
|||
} else {
|
||||
fprintf(stderr, _("%s:The specified port is missing, it can be specified by -p parameter "
|
||||
"or import environment variables PGPORT.\n"), progname);
|
||||
fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -494,12 +494,12 @@ static int DoWALWrite(const char* wal_buf, int len, XLogRecPtr& block_pos, const
|
|||
suspendHeartBeatTimer();
|
||||
return DO_WAL_DATA_WRITE_ERROR;
|
||||
}
|
||||
|
||||
/* Write was successful, advance our position */
|
||||
bytes_written += bytes_to_write;
|
||||
bytes_left -= bytes_to_write;
|
||||
XLByteAdvance(block_pos, bytes_to_write);
|
||||
xlogoff += bytes_to_write;
|
||||
lastFlushPosition = block_pos;
|
||||
|
||||
/* Did we reach the end of a WAL segment? */
|
||||
if (block_pos % XLogSegSize == 0) {
|
||||
|
|
@ -586,14 +586,12 @@ bool ReceiveXlogStream(PGconn* conn, XLogRecPtr startpos, uint32 timeline, const
|
|||
* so that the master can remove WAL.
|
||||
*/
|
||||
|
||||
reportFlushPosition = true;
|
||||
ss_c = snprintf_s(slotcmd, MAXPGPATH, MAXPGPATH - 1, "SLOT \"%s\" ", replication_slot);
|
||||
securec_check_ss_c(ss_c, "", "");
|
||||
} else {
|
||||
reportFlushPosition = false;
|
||||
slotcmd[0] = 0;
|
||||
}
|
||||
|
||||
reportFlushPosition = true;
|
||||
if (sysidentifier != NULL) {
|
||||
/* Validate system identifier and timeline hasn't changed */
|
||||
res = PQexec(conn, "IDENTIFY_SYSTEM");
|
||||
|
|
|
|||
|
|
@ -297,7 +297,7 @@ static void show_version(int alls)
|
|||
if (alls) {
|
||||
printf("OPENGAUSS_VERSION = ");
|
||||
}
|
||||
printf("openGauss 3.1.0\n");
|
||||
printf("openGauss 5.0.0\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue