I got it to work! I believe akkartik was right. Using command (-c) did the trick, which I assume ensured disconnecting from the database.
(system "psql -U root -d root -c 'SELECT * FROM items'")
item_id | name | type | description | created | location ---------+--------+------+-------------------------------------+----------------------------+---------------------------------------------------- 1 | marble | tool | A small, translucent orange bauble. | 2022-02-23 17:59:45.480545 | 0101000020E610000012C2A38D239A5EC040683D7C99E44240 (1 row)