diff --git a/dba/base-data.sql b/dba/base-data.sql index d3a2cb61..ee303695 100644 --- a/dba/base-data.sql +++ b/dba/base-data.sql @@ -1,4 +1,4 @@ --- Some sample data to prime the database... +-- Some base data to prime the database... -- FIXME: Only insert the rows if they are not there already. INSERT INTO roles ( role_no, role_name ) VALUES( 1, 'Admin'); @@ -9,11 +9,19 @@ INSERT INTO roles ( role_no, role_name ) VALUES( 4, 'Resource'); -- Set the insert sequence to the next number, with a minimum of 10 SELECT setval('roles_role_no_seq', (SELECT 10 UNION SELECT role_no FROM roles ORDER BY 1 DESC LIMIT 1) ); +INSERT INTO principal_type (principal_type_id, principal_type_desc) VALUES( 1, 'Person' ); +INSERT INTO principal_type (principal_type_id, principal_type_desc) VALUES( 2, 'Resource' ); +INSERT INTO principal_type (principal_type_id, principal_type_desc) VALUES( 3, 'Group' ); + +-- Create the administrator record. INSERT INTO usr ( user_no, active, email_ok, updated, username, password, fullname, email ) VALUES ( 1, TRUE, current_date, current_date, 'admin', '**nimda', 'DAViCal Administrator', 'calendars@example.net' ); +INSERT INTO principal ( principal_id, type_id, user_no, displayname, default_privileges ) + VALUES ( 1, 1, 1, 'DAViCal Administrator', 0::BIT(24) ); INSERT INTO role_member (user_no, role_no) VALUES(1, 1); + -- Set the insert sequence to the next number, with a minimum of 1000 SELECT setval('usr_user_no_seq', (SELECT 1000 UNION SELECT user_no FROM usr ORDER BY 1 DESC LIMIT 1) ); @@ -29,12 +37,6 @@ INSERT INTO relationship_type ( rt_id, rt_name, confers, bit_confers ) INSERT INTO relationship_type ( rt_id, rt_name, confers, bit_confers ) VALUES( 4, 'Can see free/busy time of', 'F', privilege_to_bits( 'caldav:read-free-busy') ); -INSERT INTO principal_type (principal_type_id, principal_type_desc) VALUES( 1, 'Person' ); -INSERT INTO principal_type (principal_type_id, principal_type_desc) VALUES( 2, 'Resource' ); -INSERT INTO principal_type (principal_type_id, principal_type_desc) VALUES( 3, 'Group' ); - -INSERT INTO principal ( type_id, user_no, displayname, default_privileges ) - VALUES ( 1, 1, 'DAViCal Administrator', 0::BIT(24) ); -- Set the insert sequence to the next number, with a minimum of 1000 SELECT setval('relationship_type_rt_id_seq', (SELECT 10 UNION SELECT rt_id FROM relationship_type ORDER BY 1 DESC LIMIT 1) ); diff --git a/testing/tests/binding/1000-BIND.result b/testing/tests/binding/1000-BIND.result index 83a5a805..abfbeb5d 100644 --- a/testing/tests/binding/1000-BIND.result +++ b/testing/tests/binding/1000-BIND.result @@ -7,11 +7,11 @@ Content-Length: 0 Content-Type: text/plain; charset="utf-8" - bind_id: >1437< + bind_id: >1450< bound_source_id: >11< dav_displayname: >User 2's Calendar, as uploaded by Admin< dav_name: >/user4/user2/< - dav_owner_id: >6< + dav_owner_id: >1005< length: >8< parent_container: >/user4/< diff --git a/testing/tests/binding/1001-BIND.result b/testing/tests/binding/1001-BIND.result index 99d5fb1d..399328d0 100644 --- a/testing/tests/binding/1001-BIND.result +++ b/testing/tests/binding/1001-BIND.result @@ -9,11 +9,11 @@ Content-Type: text/xml; charset="utf-8" A resource already exists at the destination. - bind_id: >1437< + bind_id: >1450< bound_source_id: >11< dav_displayname: >User 2's Calendar, as uploaded by Admin< dav_name: >/user4/user2/< - dav_owner_id: >6< + dav_owner_id: >1005< length: >8< parent_container: >/user4/< diff --git a/testing/tests/binding/1004-PROPFIND-bound.result b/testing/tests/binding/1004-PROPFIND-bound.result index 3a07021f..6676f4b5 100644 --- a/testing/tests/binding/1004-PROPFIND-bound.result +++ b/testing/tests/binding/1004-PROPFIND-bound.result @@ -6,7 +6,7 @@ User 4 - /caldav.php/.resources/6 + /caldav.php/.resources/1005 @@ -64,7 +64,7 @@ User 4 Outbox - /caldav.php/.resources/1435 + /caldav.php/.resources/1448 diff --git a/testing/tests/binding/1012-BIND.result b/testing/tests/binding/1012-BIND.result index efcf5a5e..9056ff22 100644 --- a/testing/tests/binding/1012-BIND.result +++ b/testing/tests/binding/1012-BIND.result @@ -7,14 +7,14 @@ Content-Length: 0 Content-Type: text/plain; charset="utf-8" - bind_id: >1437< + bind_id: >1450< bound_source_id: >11< dav_displayname: >Updated Displayname with PROPPATCH< dav_name: >/user4/user2/< parent_container: >/user4/< ticket_id_length: >8< - bind_id: >1438< + bind_id: >1451< bound_source_id: >10< dav_displayname: >User 1's Calendaranza< dav_name: >/user4/user1/< diff --git a/testing/tests/binding/1022-BIND.result b/testing/tests/binding/1022-BIND.result index 9cfaeab1..7a9d1171 100644 --- a/testing/tests/binding/1022-BIND.result +++ b/testing/tests/binding/1022-BIND.result @@ -7,21 +7,21 @@ Content-Length: 0 Content-Type: text/plain; charset="utf-8" - bind_id: >1437< + bind_id: >1450< bound_source_id: >11< dav_displayname: >Updated Displayname with PROPPATCH< dav_name: >/user4/user2/< length: >8< parent_container: >/user4/< - bind_id: >1438< + bind_id: >1451< bound_source_id: >10< dav_displayname: >User 1's Calendaranza< dav_name: >/user4/user1/< length: >8< parent_container: >/user4/< - bind_id: >1442< + bind_id: >1455< bound_source_id: >10< dav_displayname: >User 1's Calendaranza< dav_name: >/user4/base/user1/< diff --git a/testing/tests/binding/1023-BIND.result b/testing/tests/binding/1023-BIND.result index 19653b52..6a0f1d14 100644 --- a/testing/tests/binding/1023-BIND.result +++ b/testing/tests/binding/1023-BIND.result @@ -7,28 +7,28 @@ Content-Length: 0 Content-Type: text/plain; charset="utf-8" - bind_id: >1437< + bind_id: >1450< bound_source_id: >11< dav_displayname: >Updated Displayname with PROPPATCH< dav_name: >/user4/user2/< length: >8< parent_container: >/user4/< - bind_id: >1438< + bind_id: >1451< bound_source_id: >10< dav_displayname: >User 1's Calendaranza< dav_name: >/user4/user1/< length: >8< parent_container: >/user4/< - bind_id: >1442< + bind_id: >1455< bound_source_id: >10< dav_displayname: >User 1's Calendaranza< dav_name: >/user4/base/user1/< length: >8< parent_container: >/user4/base/< - bind_id: >1443< + bind_id: >1456< bound_source_id: >11< dav_displayname: >User 2's Calendar, as uploaded by Admin< dav_name: >/user4/base/user2/< diff --git a/testing/tests/binding/1024-BIND.result b/testing/tests/binding/1024-BIND.result index d05c4847..019eda6a 100644 --- a/testing/tests/binding/1024-BIND.result +++ b/testing/tests/binding/1024-BIND.result @@ -9,28 +9,28 @@ Content-Type: text/xml; charset="utf-8" A resource already exists at the destination. - bind_id: >1437< + bind_id: >1450< bound_source_id: >11< dav_displayname: >Updated Displayname with PROPPATCH< dav_name: >/user4/user2/< length: >8< parent_container: >/user4/< - bind_id: >1438< + bind_id: >1451< bound_source_id: >10< dav_displayname: >User 1's Calendaranza< dav_name: >/user4/user1/< length: >8< parent_container: >/user4/< - bind_id: >1442< + bind_id: >1455< bound_source_id: >10< dav_displayname: >User 1's Calendaranza< dav_name: >/user4/base/user1/< length: >8< parent_container: >/user4/base/< - bind_id: >1443< + bind_id: >1456< bound_source_id: >11< dav_displayname: >User 2's Calendar, as uploaded by Admin< dav_name: >/user4/base/user2/< diff --git a/testing/tests/binding/1025-PROPFIND.result b/testing/tests/binding/1025-PROPFIND.result index 7b05081b..7fd5e7a5 100644 --- a/testing/tests/binding/1025-PROPFIND.result +++ b/testing/tests/binding/1025-PROPFIND.result @@ -6,7 +6,7 @@ A normal collection - /caldav.php/.resources/1440 + /caldav.php/.resources/1453 @@ -90,7 +90,7 @@ A sub collection - /caldav.php/.resources/1441 + /caldav.php/.resources/1454 diff --git a/testing/tests/binding/1027-PROPFIND.result b/testing/tests/binding/1027-PROPFIND.result index 588842c0..629ff84d 100644 --- a/testing/tests/binding/1027-PROPFIND.result +++ b/testing/tests/binding/1027-PROPFIND.result @@ -6,7 +6,7 @@ A normal collection - /caldav.php/.resources/1440 + /caldav.php/.resources/1453 diff --git a/testing/tests/binding/1028-PROPFIND.result b/testing/tests/binding/1028-PROPFIND.result index 58d8ae80..8f8c9e8f 100644 --- a/testing/tests/binding/1028-PROPFIND.result +++ b/testing/tests/binding/1028-PROPFIND.result @@ -8,7 +8,7 @@ /caldav.php/user4/ - /caldav.php/.resources/6 + /caldav.php/.resources/1005 diff --git a/testing/tests/binding/1032-BIND-admin.result b/testing/tests/binding/1032-BIND-admin.result index 1c58adb4..5dfc2f02 100644 --- a/testing/tests/binding/1032-BIND-admin.result +++ b/testing/tests/binding/1032-BIND-admin.result @@ -7,8 +7,8 @@ Content-Length: 0 Content-Type: text/plain; charset="utf-8" - bind_id: >1437< - bind_owner: >6< + bind_id: >1450< + bind_owner: >1005< bound_source_id: >11< dav_displayname: >Updated Displayname with PROPPATCH< dav_name: >/user4/user2/< @@ -17,10 +17,10 @@ Content-Type: text/plain; charset="utf-8" privileges: >000000000001001011100111< target_collection: >11< target_resource_i: >NULL< - ticket_owner: >4< + ticket_owner: >1003< - bind_id: >1438< - bind_owner: >6< + bind_id: >1451< + bind_owner: >1005< bound_source_id: >10< dav_displayname: >User 1's Calendaranza< dav_name: >/user4/user1/< @@ -29,10 +29,10 @@ target_resource_i: >NULL< privileges: >000000000001001000100001< target_collection: >10< target_resource_i: >NULL< - ticket_owner: >3< + ticket_owner: >1002< - bind_id: >1442< - bind_owner: >6< + bind_id: >1455< + bind_owner: >1005< bound_source_id: >10< dav_displayname: >User 1's Calendaranza< dav_name: >/user4/base/user1/< @@ -41,10 +41,10 @@ target_resource_i: >NULL< privileges: >000000000001001000100001< target_collection: >10< target_resource_i: >NULL< - ticket_owner: >3< + ticket_owner: >1002< - bind_id: >1443< - bind_owner: >6< + bind_id: >1456< + bind_owner: >1005< bound_source_id: >11< dav_displayname: >User 2's Calendar, as uploaded by Admin< dav_name: >/user4/base/user2/< @@ -53,9 +53,9 @@ target_resource_i: >NULL< privileges: >000000000001001011100111< target_collection: >11< target_resource_i: >NULL< - ticket_owner: >4< + ticket_owner: >1003< - bind_id: >1456< + bind_id: >1469< bind_owner: >1< bound_source_id: >12< dav_displayname: >user3 home< diff --git a/testing/tests/binding/1034-DELETE-admin-bind.result b/testing/tests/binding/1034-DELETE-admin-bind.result index c9d88612..3e8f18cc 100644 --- a/testing/tests/binding/1034-DELETE-admin-bind.result +++ b/testing/tests/binding/1034-DELETE-admin-bind.result @@ -6,17 +6,17 @@ Content-Length: 0 Content-Type: text/plain; charset="utf-8" - bind_id: >1442< + bind_id: >1455< bound_source_id: >10< dav_displayname: >User 1's Calendaranza< dav_name: >/user4/base/user1/< - dav_owner_id: >6< + dav_owner_id: >1005< parent_container: >/user4/base/< - bind_id: >1443< + bind_id: >1456< bound_source_id: >11< dav_displayname: >User 2's Calendar, as uploaded by Admin< dav_name: >/user4/base/user2/< - dav_owner_id: >6< + dav_owner_id: >1005< parent_container: >/user4/base/< diff --git a/testing/tests/binding/1100-BIND.result b/testing/tests/binding/1100-BIND.result index 73470a0f..6999eaab 100644 --- a/testing/tests/binding/1100-BIND.result +++ b/testing/tests/binding/1100-BIND.result @@ -7,36 +7,36 @@ Content-Length: 0 Content-Type: text/plain; charset="utf-8" - bind_id: >1437< + bind_id: >1450< bound_source_id: >11< dav_displayname: >Updated Displayname with PROPPATCH< dav_name: >/user4/user2/< length: >8< parent_container: >/user4/< - bind_id: >1438< + bind_id: >1451< bound_source_id: >10< dav_displayname: >User 1's Calendaranza< dav_name: >/user4/user1/< length: >8< parent_container: >/user4/< - bind_id: >1442< + bind_id: >1455< bound_source_id: >10< dav_displayname: >User 1's Calendaranza< dav_name: >/user4/base/user1/< length: >8< parent_container: >/user4/base/< - bind_id: >1443< + bind_id: >1456< bound_source_id: >11< dav_displayname: >User 2's Calendar, as uploaded by Admin< dav_name: >/user4/base/user2/< length: >8< parent_container: >/user4/base/< - bind_id: >1457< - bound_source_id: >1440< + bind_id: >1470< + bound_source_id: >1453< dav_displayname: >A normal collection< dav_name: >/user4/boundbase/< length: >NULL< diff --git a/testing/tests/binding/1101-PROPFIND-normal.result b/testing/tests/binding/1101-PROPFIND-normal.result index 812efa58..db6d18a2 100644 --- a/testing/tests/binding/1101-PROPFIND-normal.result +++ b/testing/tests/binding/1101-PROPFIND-normal.result @@ -6,7 +6,7 @@ A normal collection - /caldav.php/.resources/1440 + /caldav.php/.resources/1453 @@ -90,7 +90,7 @@ A sub collection - /caldav.php/.resources/1441 + /caldav.php/.resources/1454 @@ -112,7 +112,7 @@ newcalendar - /caldav.php/.resources/1446 + /caldav.php/.resources/1459 diff --git a/testing/tests/binding/1102-PROPFIND-bound.result b/testing/tests/binding/1102-PROPFIND-bound.result index a4aa2da1..d58c86cc 100644 --- a/testing/tests/binding/1102-PROPFIND-bound.result +++ b/testing/tests/binding/1102-PROPFIND-bound.result @@ -6,7 +6,7 @@ A normal collection - /caldav.php/.resources/1440 + /caldav.php/.resources/1453 @@ -99,7 +99,7 @@ A sub collection - /caldav.php/.resources/1441 + /caldav.php/.resources/1454 @@ -125,7 +125,7 @@ newcalendar - /caldav.php/.resources/1446 + /caldav.php/.resources/1459 diff --git a/testing/tests/binding/Restore-Database.result b/testing/tests/binding/Restore-Database.result index a10decc8..fba87b62 100644 --- a/testing/tests/binding/Restore-Database.result +++ b/testing/tests/binding/Restore-Database.result @@ -1,6 +1,6 @@ setval -------- - 1436 + 1449 (1 row) setval diff --git a/testing/tests/carddav/Restore-Database.result b/testing/tests/carddav/Restore-Database.result index ff40f9ce..753c7113 100644 --- a/testing/tests/carddav/Restore-Database.result +++ b/testing/tests/carddav/Restore-Database.result @@ -1,6 +1,6 @@ setval -------- - 1457 + 1470 (1 row) setval diff --git a/testing/tests/regression-suite/0902-PUT-collection.result b/testing/tests/regression-suite/0902-PUT-collection.result index 98e5bff9..fd5f994d 100644 --- a/testing/tests/regression-suite/0902-PUT-collection.result +++ b/testing/tests/regression-suite/0902-PUT-collection.result @@ -16,7 +16,7 @@ Content-Type: text/plain; charset="utf-8" attendees: >40< - collection_id: >1402< + collection_id: >1415< dav_displayname: >anotherone< dav_etag: >f9a8ee6b41d9b02aa5176e6da349121a< dav_name: >/user1/anotherone/< diff --git a/testing/tests/regression-suite/0924-MOVE.result b/testing/tests/regression-suite/0924-MOVE.result index 779bf750..308b8eac 100644 --- a/testing/tests/regression-suite/0924-MOVE.result +++ b/testing/tests/regression-suite/0924-MOVE.result @@ -6,9 +6,9 @@ Content-Length: 0 Content-Type: text/plain; charset="utf-8" - cd_collection: >1402< + cd_collection: >1415< cd_user_no: >10< - ci_collection: >1402< + ci_collection: >1415< ci_user_no: >10< data_name: >/user1/anotherone/DAYPARTY-77C6-4FB7-BDD3-6882E2F1BE74.ics< item_name: >/user1/anotherone/DAYPARTY-77C6-4FB7-BDD3-6882E2F1BE74.ics< diff --git a/testing/tests/regression-suite/0945-ACL.result b/testing/tests/regression-suite/0945-ACL.result index bc85e722..7a3ad7dd 100644 --- a/testing/tests/regression-suite/0945-ACL.result +++ b/testing/tests/regression-suite/0945-ACL.result @@ -7,20 +7,20 @@ Content-Type: text/plain; charset="utf-8" by_collection: >NULL< - by_principal: >3< + by_principal: >1002< displayname: >User 4< privileges: >000000001111111011111111< - to_principal: >6< + to_principal: >1005< by_collection: >NULL< - by_principal: >3< + by_principal: >1002< displayname: >Assistant 1< privileges: >000000000001001011000111< - to_principal: >10< + to_principal: >1009< by_collection: >NULL< - by_principal: >3< + by_principal: >1002< displayname: >Team for Client1< privileges: >000000000001001000000001< - to_principal: >14< + to_principal: >1013< diff --git a/testing/tests/regression-suite/0946-ACL.result b/testing/tests/regression-suite/0946-ACL.result index ad38cf2f..05afd267 100644 --- a/testing/tests/regression-suite/0946-ACL.result +++ b/testing/tests/regression-suite/0946-ACL.result @@ -10,5 +10,5 @@ Content-Type: text/plain; charset="utf-8" by_principal: >NULL< displayname: >User 4< privileges: >000000000000001000110001< - to_principal: >6< + to_principal: >1005< diff --git a/testing/tests/regression-suite/0947-ACL.result b/testing/tests/regression-suite/0947-ACL.result index 6e631ade..6317a3e9 100644 --- a/testing/tests/regression-suite/0947-ACL.result +++ b/testing/tests/regression-suite/0947-ACL.result @@ -7,20 +7,20 @@ Content-Type: text/plain; charset="utf-8" by_collection: >NULL< - by_principal: >3< + by_principal: >1002< displayname: >User 4< privileges: >000000000001001000100001< - to_principal: >6< + to_principal: >1005< by_collection: >NULL< - by_principal: >3< + by_principal: >1002< displayname: >Assistant 1< privileges: >000000000001001011000111< - to_principal: >10< + to_principal: >1009< by_collection: >NULL< - by_principal: >3< + by_principal: >1002< displayname: >Team for Client1< privileges: >000000000001001000000001< - to_principal: >14< + to_principal: >1013< diff --git a/testing/tests/regression-suite/0948-MKTICKET.result b/testing/tests/regression-suite/0948-MKTICKET.result index 6fe80f6d..b348b1de 100644 --- a/testing/tests/regression-suite/0948-MKTICKET.result +++ b/testing/tests/regression-suite/0948-MKTICKET.result @@ -25,7 +25,7 @@ Content-Type: text/xml; charset="utf-8" - dav_owner_id: >3< + dav_owner_id: >1002< privileges: >000000000001001000100001< target_collection: >10< target_resource_i: >NULL< diff --git a/testing/tests/regression-suite/0949-MKTICKET.result b/testing/tests/regression-suite/0949-MKTICKET.result index a0287293..8b9e6864 100644 --- a/testing/tests/regression-suite/0949-MKTICKET.result +++ b/testing/tests/regression-suite/0949-MKTICKET.result @@ -11,7 +11,7 @@ Content-Type: text/xml; charset="utf-8" - dav_owner_id: >3< + dav_owner_id: >1002< privileges: >000000000001001000100001< target_collection: >10< target_resource_i: >NULL< diff --git a/testing/tests/regression-suite/0950-MKTICKET.result b/testing/tests/regression-suite/0950-MKTICKET.result index 3e052db4..e11fb50c 100644 --- a/testing/tests/regression-suite/0950-MKTICKET.result +++ b/testing/tests/regression-suite/0950-MKTICKET.result @@ -30,15 +30,15 @@ Content-Type: text/xml; charset="utf-8" - dav_owner_id: >3< + dav_owner_id: >1002< privileges: >000000000001001000100001< target_collection: >10< target_resource_i: >NULL< timeout: >01:00:00< - dav_owner_id: >3< + dav_owner_id: >1002< privileges: >000000000001001011100111< target_collection: >10< -target_resource_i: >1369< +target_resource_i: >1382< timeout: >1 day< diff --git a/testing/tests/regression-suite/0951-MKTICKET.result b/testing/tests/regression-suite/0951-MKTICKET.result index 4720d397..53228bae 100644 --- a/testing/tests/regression-suite/0951-MKTICKET.result +++ b/testing/tests/regression-suite/0951-MKTICKET.result @@ -10,15 +10,15 @@ - dav_owner_id: >3< + dav_owner_id: >1002< privileges: >000000000001001000100001< target_collection: >10< target_resource_i: >NULL< timeout: >01:00:00< - dav_owner_id: >3< + dav_owner_id: >1002< privileges: >000000000001001011100111< target_collection: >10< -target_resource_i: >1369< +target_resource_i: >1382< timeout: >24:00:00< diff --git a/testing/tests/regression-suite/0955-DELTICKET.result b/testing/tests/regression-suite/0955-DELTICKET.result index 5b694d8d..b86b59c7 100644 --- a/testing/tests/regression-suite/0955-DELTICKET.result +++ b/testing/tests/regression-suite/0955-DELTICKET.result @@ -6,7 +6,7 @@ Content-Length: 0 Content-Type: text/plain; charset="utf-8" - dav_owner_id: >3< + dav_owner_id: >1002< privileges: >000000000001001000100001< target_collection: >10< target_resource_i: >NULL< diff --git a/testing/tests/regression-suite/0957-MKTICKET.result b/testing/tests/regression-suite/0957-MKTICKET.result index 926b8d23..1569120a 100644 --- a/testing/tests/regression-suite/0957-MKTICKET.result +++ b/testing/tests/regression-suite/0957-MKTICKET.result @@ -30,13 +30,13 @@ Content-Type: text/xml; charset="utf-8" - dav_owner_id: >3< + dav_owner_id: >1002< privileges: >000000000001001000100001< target_collection: >10< target_resource_i: >NULL< timeout: >01:00:00< - dav_owner_id: >4< + dav_owner_id: >1003< privileges: >000000000001001011100111< target_collection: >11< target_resource_i: >NULL< diff --git a/testing/tests/regression-suite/sample-data.sql b/testing/tests/regression-suite/sample-data.sql index ce3d06d0..e7310ce7 100644 --- a/testing/tests/regression-suite/sample-data.sql +++ b/testing/tests/regression-suite/sample-data.sql @@ -42,6 +42,7 @@ INSERT INTO usr ( user_no, active, email_ok, updated, username, password, fullna INSERT INTO role_member (user_no, role_no) VALUES( 300, 2); SELECT setval('usr_user_no_seq', 1000); +SELECT setval('dav_id_seq', 1000); UPDATE usr SET joined = '2009-06-01', updated = '2009-06-02'; @@ -69,8 +70,6 @@ INSERT INTO principal (type_id, user_no, displayname, default_privileges) WHERE EXISTS(SELECT 1 FROM role_member JOIN roles USING(role_no) WHERE role_name = 'Group' AND role_member.user_no = usr.user_no) AND NOT EXISTS(SELECT 1 FROM principal WHERE principal.user_no = usr.user_no); -SELECT setval('dav_id_seq', 1000); - -- Set the insert sequence to the next number, with a minimum of 1000 SELECT setval('relationship_type_rt_id_seq', (SELECT 10 UNION SELECT rt_id FROM relationship_type ORDER BY 1 DESC LIMIT 1) );