Skip to content

Commit cf93b57

Browse files
committed
sql: remove enable_row_level_security feature gate
Row-level security (RLS) was initially introduced behind a feature gate in v25.1 to enable incremental development. With the feature nearing completion—pending only #141998—this commit removes the enable_row_level_security feature gate. This change makes RLS generally available without requiring the feature to be explicitly enabled. Informs: #137122 Epic: CRDB-11724 Release note: None
1 parent f66151f commit cf93b57

File tree

47 files changed

+154
-570
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+154
-570
lines changed

pkg/ccl/changefeedccl/changefeed_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,6 @@ func TestRLSBlocking(t *testing.T) {
393393
testFn := func(t *testing.T, s TestServer, f cdctest.TestFeedFactory) {
394394
sqlDB := sqlutils.MakeSQLRunner(s.DB)
395395
sqlDB.Exec(t, `CREATE TABLE rls (a INT PRIMARY KEY, b STRING)`)
396-
sqlDB.Exec(t, `SET enable_row_level_security = on`)
397396
sqlDB.Exec(t, `INSERT INTO rls VALUES (0, 'initial')`)
398397
sqlDB.Exec(t, `INSERT INTO rls VALUES (1, 'second')`)
399398

pkg/ccl/logictestccl/testdata/logic_test/partitioning

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -413,9 +413,6 @@ ok1 CREATE TABLE public.ok1 (
413413

414414
subtest partition_with_rls
415415

416-
statement ok
417-
set enable_row_level_security=on;
418-
419416
statement ok
420417
ALTER TABLE ok1 ENABLE ROW LEVEL SECURITY;
421418

@@ -446,9 +443,6 @@ DROP POLICY test_policy ON ok1;
446443
statement ok
447444
ALTER TABLE ok1 DISABLE ROW LEVEL SECURITY;
448445

449-
statement ok
450-
set enable_row_level_security=off;
451-
452446
subtest end
453447

454448
query T

pkg/cmd/roachtest/testdata/pg_regress/equivclass.diffs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/equivclass.out --
658658
explain (costs off)
659659
select * from ec1,
660660
(select ff + 1 as x from
661-
@@ -362,92 +525,110 @@
661+
@@ -362,92 +525,108 @@
662662
union all
663663
select ff + 4 as x from ec1) as ss1
664664
where ss1.x = ec1.f1 and ec1.ff = 42::int8;
@@ -714,9 +714,7 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/equivclass.out --
714714
alter table ec1 enable row level security;
715715
+ERROR: relation "ec1" does not exist
716716
create policy p1 on ec1 using (f1 < '5'::int8alias1);
717-
+ERROR: unimplemented: row-level security is not yet implemented
718-
+HINT: You have attempted to use a feature that is not yet implemented.
719-
+See: https://go.crdb.dev/issue-v/73596/_version_
717+
+ERROR: relation "ec1" does not exist
720718
create user regress_user_ectest;
721719
grant select on ec0 to regress_user_ectest;
722720
grant select on ec1 to regress_user_ectest;

pkg/cmd/roachtest/testdata/pg_regress/event_trigger.diffs

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -914,7 +914,7 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/event_trigger.out
914914
CREATE TABLE event_trigger_test (a integer, b text);
915915
CREATE OR REPLACE FUNCTION start_command()
916916
RETURNS event_trigger AS $$
917-
@@ -563,37 +780,58 @@
917+
@@ -563,37 +780,46 @@
918918
RAISE NOTICE '% - ddl_command_start', tg_tag;
919919
END;
920920
$$ LANGUAGE plpgsql;
@@ -957,32 +957,20 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/event_trigger.out
957957
CREATE POLICY p1 ON event_trigger_test USING (FALSE);
958958
-NOTICE: CREATE POLICY - ddl_command_start
959959
-NOTICE: CREATE POLICY - ddl_command_end
960-
+ERROR: unimplemented: row-level security is not yet implemented
961-
+HINT: You have attempted to use a feature that is not yet implemented.
962-
+See: https://go.crdb.dev/issue-v/73596/_version_
963960
ALTER POLICY p1 ON event_trigger_test USING (TRUE);
964961
-NOTICE: ALTER POLICY - ddl_command_start
965962
-NOTICE: ALTER POLICY - ddl_command_end
966-
+ERROR: unimplemented: ALTER POLICY is not yet implemented
967-
+HINT: You have attempted to use a feature that is not yet implemented.
968-
+See: https://go.crdb.dev/issue-v/136997/_version_
969963
ALTER POLICY p1 ON event_trigger_test RENAME TO p2;
970964
-NOTICE: ALTER POLICY - ddl_command_start
971965
-NOTICE: ALTER POLICY - ddl_command_end
972-
+ERROR: unimplemented: ALTER POLICY is not yet implemented
973-
+HINT: You have attempted to use a feature that is not yet implemented.
974-
+See: https://go.crdb.dev/issue-v/136996/_version_
975966
DROP POLICY p2 ON event_trigger_test;
976967
-NOTICE: DROP POLICY - ddl_command_start
977968
-NOTICE: DROP POLICY - sql_drop
978969
-NOTICE: DROP POLICY - ddl_command_end
979-
+ERROR: unimplemented: row-level security is not yet implemented
980-
+HINT: You have attempted to use a feature that is not yet implemented.
981-
+See: https://go.crdb.dev/issue-v/73596/_version_
982970
-- Check the object addresses of all the event triggers.
983971
SELECT
984972
e.evtname,
985-
@@ -604,13 +842,22 @@
973+
@@ -604,13 +830,22 @@
986974
LATERAL pg_identify_object_as_address('pg_event_trigger'::regclass, e.oid, 0) as b,
987975
LATERAL pg_get_object_address(b.type, b.object_names, b.object_args) as a
988976
ORDER BY e.evtname;

pkg/cmd/roachtest/testdata/pg_regress/merge.diffs

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2008,7 +2008,7 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/merge.out --label
20082008
ROLLBACK;
20092009
-- try updating the partition key column
20102010
BEGIN;
2011-
@@ -1732,64 +1690,102 @@
2011+
@@ -1732,64 +1690,100 @@
20122012
UPDATE SET tid = tid + 1, balance = balance + delta, val = val || ' updated by merge'
20132013
WHEN NOT MATCHED THEN
20142014
INSERT VALUES (sid, delta, 'inserted by merge');
@@ -2045,9 +2045,7 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/merge.out --label
20452045
ALTER TABLE pa_target FORCE ROW LEVEL SECURITY;
20462046
+ERROR: relation "pa_target" does not exist
20472047
CREATE POLICY pa_target_pol ON pa_target USING (tid != 0);
2048-
+ERROR: unimplemented: row-level security is not yet implemented
2049-
+HINT: You have attempted to use a feature that is not yet implemented.
2050-
+See: https://go.crdb.dev/issue-v/73596/_version_
2048+
+ERROR: relation "pa_target" does not exist
20512049
MERGE INTO pa_target t
20522050
USING pa_source s
20532051
ON t.tid = s.sid AND t.tid IN (1,2,3,4)
@@ -2130,7 +2128,7 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/merge.out --label
21302128
-- try simple MERGE
21312129
BEGIN;
21322130
MERGE INTO pa_target t
2133-
@@ -1799,91 +1795,78 @@
2131+
@@ -1799,91 +1793,78 @@
21342132
UPDATE SET balance = balance + delta, val = val || ' updated by merge'
21352133
WHEN NOT MATCHED THEN
21362134
INSERT VALUES (slogts::timestamp, sid, delta, 'inserted by merge');
@@ -2262,7 +2260,7 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/merge.out --label
22622260
INSERT INTO cj_source1 VALUES (1, 10, 100);
22632261
INSERT INTO cj_source1 VALUES (1, 20, 200);
22642262
INSERT INTO cj_source1 VALUES (2, 20, 300);
2265-
@@ -1898,6 +1881,10 @@
2263+
@@ -1898,6 +1879,10 @@
22662264
ON t.tid = sid1
22672265
WHEN NOT MATCHED THEN
22682266
INSERT VALUES (sid1, delta, sval);
@@ -2273,7 +2271,7 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/merge.out --label
22732271
-- try accessing columns from either side of the source join
22742272
MERGE INTO cj_target t
22752273
USING cj_source2 s2
2276-
@@ -1907,6 +1894,10 @@
2274+
@@ -1907,6 +1892,10 @@
22772275
INSERT VALUES (sid2, delta, sval)
22782276
WHEN MATCHED THEN
22792277
DELETE;
@@ -2284,7 +2282,7 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/merge.out --label
22842282
-- some simple expressions in INSERT targetlist
22852283
MERGE INTO cj_target t
22862284
USING cj_source2 s2
2287-
@@ -1916,20 +1907,24 @@
2285+
@@ -1916,20 +1905,24 @@
22882286
INSERT VALUES (sid2, delta + scat, sval)
22892287
WHEN MATCHED THEN
22902288
UPDATE SET val = val || ' updated by merge';
@@ -2316,7 +2314,7 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/merge.out --label
23162314

23172315
-- try it with an outer join and PlaceHolderVar
23182316
MERGE INTO cj_target t
2319-
@@ -1938,19 +1933,14 @@
2317+
@@ -1938,19 +1931,14 @@
23202318
ON t.tid = fj.scat
23212319
WHEN NOT MATCHED THEN
23222320
INSERT (tid, balance, val) VALUES (fj.scat, fj.delta, fj.phv);
@@ -2343,7 +2341,7 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/merge.out --label
23432341

23442342
ALTER TABLE cj_source1 RENAME COLUMN sid1 TO sid;
23452343
ALTER TABLE cj_source2 RENAME COLUMN sid2 TO sid;
2346-
@@ -1961,10 +1951,15 @@
2344+
@@ -1961,10 +1949,15 @@
23472345
ON t.tid = s1.sid
23482346
WHEN NOT MATCHED THEN
23492347
INSERT VALUES (s2.sid, delta, sval);
@@ -2359,7 +2357,7 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/merge.out --label
23592357
MERGE INTO fs_target t
23602358
USING generate_series(1,100,1) AS id
23612359
ON t.a = id
2362-
@@ -1972,6 +1967,10 @@
2360+
@@ -1972,6 +1965,10 @@
23632361
UPDATE SET b = b + id
23642362
WHEN NOT MATCHED THEN
23652363
INSERT VALUES (id, -1);
@@ -2370,7 +2368,7 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/merge.out --label
23702368
MERGE INTO fs_target t
23712369
USING generate_series(1,100,2) AS id
23722370
ON t.a = id
2373-
@@ -1979,10 +1978,14 @@
2371+
@@ -1979,10 +1976,14 @@
23742372
UPDATE SET b = b + id, c = 'updated '|| id.*::text
23752373
WHEN NOT MATCHED THEN
23762374
INSERT VALUES (id, -1, 'inserted ' || id.*::text);
@@ -2386,7 +2384,7 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/merge.out --label
23862384
(1 row)
23872385

23882386
DROP TABLE fs_target;
2389-
@@ -1995,12 +1998,29 @@
2387+
@@ -1995,12 +1996,29 @@
23902388
peaktemp int,
23912389
unitsales int
23922390
) WITH (autovacuum_enabled=off);
@@ -2416,7 +2414,7 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/merge.out --label
24162414
CREATE TABLE measurement_y2007m01 (
24172415
filler text,
24182416
peaktemp int,
2419-
@@ -2009,8 +2029,14 @@
2417+
@@ -2009,8 +2027,14 @@
24202418
unitsales int
24212419
CHECK ( logdate >= DATE '2007-01-01' AND logdate < DATE '2007-02-01')
24222420
) WITH (autovacuum_enabled=off);
@@ -2431,15 +2429,15 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/merge.out --label
24312429
INSERT INTO measurement VALUES (0, '2005-07-21', 5, 15);
24322430
CREATE OR REPLACE FUNCTION measurement_insert_trigger()
24332431
RETURNS TRIGGER AS $$
2434-
@@ -2034,6 +2060,7 @@
2432+
@@ -2034,6 +2058,7 @@
24352433
CREATE TRIGGER insert_measurement_trigger
24362434
BEFORE INSERT ON measurement
24372435
FOR EACH ROW EXECUTE PROCEDURE measurement_insert_trigger();
24382436
+ERROR: relation "measurement_y2006m02" does not exist
24392437
INSERT INTO measurement VALUES (1, '2006-02-10', 35, 10);
24402438
INSERT INTO measurement VALUES (1, '2006-02-16', 45, 20);
24412439
INSERT INTO measurement VALUES (1, '2006-03-17', 25, 10);
2442-
@@ -2041,18 +2068,19 @@
2440+
@@ -2041,18 +2066,19 @@
24432441
INSERT INTO measurement VALUES (1, '2007-01-15', 10, 10);
24442442
INSERT INTO measurement VALUES (1, '2007-01-17', 10, 10);
24452443
SELECT tableoid::regclass, * FROM measurement ORDER BY city_id, logdate;
@@ -2468,7 +2466,7 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/merge.out --label
24682466
INSERT INTO new_measurement VALUES (0, '2005-07-21', 25, 20);
24692467
INSERT INTO new_measurement VALUES (1, '2006-03-01', 20, 10);
24702468
INSERT INTO new_measurement VALUES (1, '2006-02-16', 50, 10);
2471-
@@ -2072,25 +2100,12 @@
2469+
@@ -2072,25 +2098,12 @@
24722470
WHEN NOT MATCHED THEN INSERT
24732471
(city_id, logdate, peaktemp, unitsales)
24742472
VALUES (city_id, logdate, peaktemp, unitsales);
@@ -2499,7 +2497,7 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/merge.out --label
24992497
ROLLBACK;
25002498
MERGE into measurement m
25012499
USING new_measurement nm ON
2502-
@@ -2102,56 +2117,64 @@
2500+
@@ -2102,56 +2115,64 @@
25032501
WHEN NOT MATCHED THEN INSERT
25042502
(city_id, logdate, peaktemp, unitsales)
25052503
VALUES (city_id, logdate, peaktemp, unitsales);

pkg/cmd/roachtest/testdata/pg_regress/object_address.diffs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/object_address.out --label=/mnt/data1/postgres/src/test/regress/results/object_address.out /mnt/data1/postgres/src/test/regress/expected/object_address.out /mnt/data1/postgres/src/test/regress/results/object_address.out
22
--- /mnt/data1/postgres/src/test/regress/expected/object_address.out
33
+++ /mnt/data1/postgres/src/test/regress/results/object_address.out
4-
@@ -10,32 +10,144 @@
4+
@@ -10,32 +10,141 @@
55
CREATE SCHEMA addr_nsp;
66
SET search_path TO 'addr_nsp';
77
CREATE FOREIGN DATA WRAPPER addr_fdw;
@@ -117,9 +117,6 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/object_address.ou
117117
CREATE FUNCTION addr_nsp.trig() RETURNS TRIGGER LANGUAGE plpgsql AS $$ BEGIN END; $$;
118118
CREATE TRIGGER t BEFORE INSERT ON addr_nsp.gentable FOR EACH ROW EXECUTE PROCEDURE addr_nsp.trig();
119119
CREATE POLICY genpol ON addr_nsp.gentable;
120-
+ERROR: unimplemented: row-level security is not yet implemented
121-
+HINT: You have attempted to use a feature that is not yet implemented.
122-
+See: https://go.crdb.dev/issue-v/73596/_version_
123120
CREATE PROCEDURE addr_nsp.proc(int4) LANGUAGE SQL AS $$ $$;
124121
CREATE SERVER "integer" FOREIGN DATA WRAPPER addr_fdw;
125122
+ERROR: at or near "integer": syntax error: unimplemented: this syntax
@@ -146,7 +143,7 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/object_address.ou
146143
ALTER DEFAULT PRIVILEGES FOR ROLE regress_addr_user IN SCHEMA public GRANT ALL ON TABLES TO regress_addr_user;
147144
ALTER DEFAULT PRIVILEGES FOR ROLE regress_addr_user REVOKE DELETE ON TABLES FROM regress_addr_user;
148145
-- this transform would be quite unsafe to leave lying around,
149-
@@ -43,22 +155,75 @@
146+
@@ -43,22 +152,75 @@
150147
CREATE TRANSFORM FOR int LANGUAGE SQL (
151148
FROM SQL WITH FUNCTION prsd_lextype(internal),
152149
TO SQL WITH FUNCTION int4recv(internal));
@@ -227,7 +224,7 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/object_address.ou
227224
-- unrecognized object types
228225
DO $$
229226
DECLARE
230-
@@ -75,21 +240,33 @@
227+
@@ -75,21 +237,33 @@
231228
END LOOP;
232229
END;
233230
$$;
@@ -271,7 +268,7 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/object_address.ou
271268
DO $$
272269
DECLARE
273270
objtype text;
274-
@@ -123,265 +300,81 @@
271+
@@ -123,265 +297,81 @@
275272
END LOOP;
276273
END;
277274
$$;
@@ -584,7 +581,7 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/object_address.ou
584581
-- Make sure that NULL handling is correct.
585582
\pset null 'NULL'
586583
-- Temporarily disable fancy output, so as future additions never create
587-
@@ -455,86 +448,86 @@
584+
@@ -455,86 +445,86 @@
588585
pg_identify_object_as_address(classid, objid, objsubid) AS ioa (typ, nms, args),
589586
pg_get_object_address(typ, nms, ioa.args) AS addr2
590587
ORDER BY addr1.classid, addr1.objid, addr1.objsubid;
@@ -741,7 +738,7 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/object_address.ou
741738
--
742739
-- Checks for invalid objects
743740
--
744-
@@ -592,47 +585,6 @@
741+
@@ -592,47 +582,6 @@
745742
AS descr
746743
FROM objects
747744
ORDER BY objects.classid, objects.objid, objects.objsubid;

0 commit comments

Comments
 (0)