Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit44b61ef

Browse files
committed
Improve generated_stored test
The test table names gtest11s and gtest12s were way originally chosento signify "stored", when the idea was to have virtual columns in thesame test file. This is no longer the idea, so this naming isirrelevant. (The upcoming feature of virtual generated columns willhave a test file that is initially a copy of generated_stored.sql, andthis random difference will be even more annoying then.) Clean thisup by dropping the suffix.Discussion:https://www.postgresql.org/message-id/flat/a368248e-69e4-40be-9c07-6c3b5880b0a6@eisentraut.org
1 parentfb9f955 commit44b61ef

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

‎src/test/regress/expected/generated_stored.out

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -534,18 +534,18 @@ ALTER TABLE gtest10a DROP COLUMN b;
534534
INSERT INTO gtest10a (a) VALUES (1);
535535
-- privileges
536536
CREATE USER regress_user11;
537-
CREATE TABLEgtest11s (a int PRIMARY KEY, b int, c int GENERATED ALWAYS AS (b * 2) STORED);
538-
INSERT INTOgtest11s VALUES (1, 10), (2, 20);
539-
GRANT SELECT (a, c) ONgtest11s TO regress_user11;
537+
CREATE TABLEgtest11 (a int PRIMARY KEY, b int, c int GENERATED ALWAYS AS (b * 2) STORED);
538+
INSERT INTOgtest11 VALUES (1, 10), (2, 20);
539+
GRANT SELECT (a, c) ONgtest11 TO regress_user11;
540540
CREATE FUNCTION gf1(a int) RETURNS int AS $$ SELECT a * 3 $$ IMMUTABLE LANGUAGE SQL;
541541
REVOKE ALL ON FUNCTION gf1(int) FROM PUBLIC;
542-
CREATE TABLEgtest12s (a int PRIMARY KEY, b int, c int GENERATED ALWAYS AS (gf1(b)) STORED);
543-
INSERT INTOgtest12s VALUES (1, 10), (2, 20);
544-
GRANT SELECT (a, c) ONgtest12s TO regress_user11;
542+
CREATE TABLEgtest12 (a int PRIMARY KEY, b int, c int GENERATED ALWAYS AS (gf1(b)) STORED);
543+
INSERT INTOgtest12 VALUES (1, 10), (2, 20);
544+
GRANT SELECT (a, c) ONgtest12 TO regress_user11;
545545
SET ROLE regress_user11;
546-
SELECT a, b FROMgtest11s; -- not allowed
547-
ERROR: permission denied for tablegtest11s
548-
SELECT a, c FROMgtest11s; -- allowed
546+
SELECT a, b FROMgtest11; -- not allowed
547+
ERROR: permission denied for tablegtest11
548+
SELECT a, c FROMgtest11; -- allowed
549549
a | c
550550
---+----
551551
1 | 20
@@ -554,7 +554,7 @@ SELECT a, c FROM gtest11s; -- allowed
554554

555555
SELECT gf1(10); -- not allowed
556556
ERROR: permission denied for function gf1
557-
SELECT a, c FROMgtest12s; -- allowed
557+
SELECT a, c FROMgtest12; -- allowed
558558
a | c
559559
---+----
560560
1 | 30
@@ -564,9 +564,9 @@ SELECT a, c FROM gtest12s; -- allowed
564564
RESET ROLE;
565565
DROP FUNCTION gf1(int); -- fail
566566
ERROR: cannot drop function gf1(integer) because other objects depend on it
567-
DETAIL: column c of tablegtest12s depends on function gf1(integer)
567+
DETAIL: column c of tablegtest12 depends on function gf1(integer)
568568
HINT: Use DROP ... CASCADE to drop the dependent objects too.
569-
DROP TABLEgtest11s, gtest12s;
569+
DROP TABLEgtest11, gtest12;
570570
DROP FUNCTION gf1(int);
571571
DROP USER regress_user11;
572572
-- check constraints

‎src/test/regress/sql/generated_stored.sql

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -265,26 +265,26 @@ INSERT INTO gtest10a (a) VALUES (1);
265265
-- privileges
266266
CREATEUSERregress_user11;
267267

268-
CREATETABLEgtest11s (aintPRIMARY KEY, bint, cint GENERATED ALWAYSAS (b*2) STORED);
269-
INSERT INTOgtest11sVALUES (1,10), (2,20);
270-
GRANTSELECT (a, c)ONgtest11s TO regress_user11;
268+
CREATETABLEgtest11 (aintPRIMARY KEY, bint, cint GENERATED ALWAYSAS (b*2) STORED);
269+
INSERT INTOgtest11VALUES (1,10), (2,20);
270+
GRANTSELECT (a, c)ONgtest11 TO regress_user11;
271271

272272
CREATEFUNCTIONgf1(aint) RETURNSintAS $$SELECT a*3 $$ IMMUTABLE LANGUAGE SQL;
273273
REVOKE ALLON FUNCTION gf1(int)FROM PUBLIC;
274274

275-
CREATETABLEgtest12s (aintPRIMARY KEY, bint, cint GENERATED ALWAYSAS (gf1(b)) STORED);
276-
INSERT INTOgtest12sVALUES (1,10), (2,20);
277-
GRANTSELECT (a, c)ONgtest12s TO regress_user11;
275+
CREATETABLEgtest12 (aintPRIMARY KEY, bint, cint GENERATED ALWAYSAS (gf1(b)) STORED);
276+
INSERT INTOgtest12VALUES (1,10), (2,20);
277+
GRANTSELECT (a, c)ONgtest12 TO regress_user11;
278278

279279
SET ROLE regress_user11;
280-
SELECT a, bFROMgtest11s;-- not allowed
281-
SELECT a, cFROMgtest11s;-- allowed
280+
SELECT a, bFROMgtest11;-- not allowed
281+
SELECT a, cFROMgtest11;-- allowed
282282
SELECT gf1(10);-- not allowed
283-
SELECT a, cFROMgtest12s;-- allowed
283+
SELECT a, cFROMgtest12;-- allowed
284284
RESET ROLE;
285285

286286
DROPFUNCTION gf1(int);-- fail
287-
DROPTABLEgtest11s, gtest12s;
287+
DROPTABLEgtest11, gtest12;
288288
DROPFUNCTION gf1(int);
289289
DROPUSER regress_user11;
290290

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp