I'm not sure if this is true for all installs, or just upgrades.
But after an upgrade from 1.3, I could not open any sales invoice because I got an error:
ERROR: column a.setting_sequence does not exist
LINE 12: ... ns.location_id as locationid, a.is_return, a.setting_...
^ at bin/is.pl line 145
... a is a table alias for ar, and by digging through the LedgerSMB/Form.pm, I found lines added for gapless invoicing that refer to this column.
Searching sql/*, I found this column is not in Pg-database.sql, the only place it appears is Fixes.sql. And there, it's wrapped in a transaction, which fails on my database due to the second statement:
BEGIN;
ALTER TABLE ar ADD setting_sequence TEXT;
ALTER TABLE ar DROP CONSTRAINT ar_invnumber_key;
ALTER TABLE ar ADD CHECK(invnumber is not null OR not approved);
CREATE UNIQUE INDEX ar_invnumber_key_p ON ar(invnumber) where invnumber is not null;
COMMIT;
... I get an error that CONSTRAINT ar_invnumber_key does not exist, so the transaction is rolled back.
Ommitting that line, the other three queries succeed, and I can now open invoices.
as an immediate workaround, run the setup.pl on the db again.
https://github.com/ledgersmb/LedgerSMB/pull/589