Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trigger execution causes server to close the connection unexpectedly #77

Open
peterthesaint opened this issue Aug 16, 2024 · 1 comment

Comments

@peterthesaint
Copy link

I recently installed the extension temporal_tables on our PostgreSQL database (version 15.2, installed on Microsoft Windows Server 2022 Standard - x64).

As per the extension's installation instructions, I created a new "insert/update/delete" trigger on my existing, target table (myschema.mytable):

CREATE TRIGGER versioning_trigger BEFORE INSERT OR UPDATE OR DELETE ON myschema.mytable FOR EACH ROW EXECUTE PROCEDURE versioning('sys_period','myschema.mytablehistory',true);`

Now, however, whenever I execute any SQL command using pgAdmin 4 (Version 6.21) that inserts, updates or deletes a row in myschema.mytable, I receive the following message:

ERROR: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.

The PostgreSQL log file contains the following messages:

2024-08-15 07:06:58.500 EDT [12380] FATAL: the database system is in recovery mode
2024-08-15 07:06:58.611 EDT [18000] LOG: database system was interrupted; last known up at 2024-08-15 07:05:48 EDT
2024-08-15 07:07:01.261 EDT [18000] LOG: database system was not properly shut down; automatic recovery in progress
2024-08-15 07:07:01.278 EDT [18000] LOG: redo starts at F/69CBB4E8
2024-08-15 07:07:01.279 EDT [18000] LOG: invalid record length at F/69CBBC28: wanted 24, got 0
2024-08-15 07:07:01.279 EDT [18000] LOG: redo done at F/69CBBBF0 system usage: CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.00 s
2024-08-15 07:07:01.299 EDT [10208] LOG: checkpoint starting: end-of-recovery immediate wait
2024-08-15 07:07:01.333 EDT [10208] LOG: checkpoint complete: wrote 3 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.008 s, sync=0.006 s, total=0.037 s; sync files=4, longest=0.002 s, average=0.002 s; distance=1 kB, estimate=1 kB

I can't tell if the temporal_tables extension (or its trigger function) is failing or if there's a PostgreSQL setting I need to change in order to make this work.

Any and all advice much appreciated.

@arkhipov
Copy link
Owner

arkhipov commented Nov 4, 2024

This usually means that something crashed inside the server. As I can see there is a test for PG 15.4 on Windows x64 which passes. Which version of the extension do you use? If you could make a reproducible test like the one I mentioned that would help a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants