How can I save database current state as file? lazarus / 16-Databases ---------------------------------------------------------------------- loaded · 2021-10-11 08:09 Hi All, The database I use is Postgresql, I use Pgadmin for backup and restore operations. My aim is; Can I save the state of the DATASOURCEI use when I make a SQL query to the file? And then can I update the database by posting this file? It could be: To take a backup of the table I use, together with the schema and data, as a binary file via LAZARUS, and to restore it using this file when necessary. Is it possible ? If anyone has any experience with the subject, I'd appreciate it. Respects. ---------------------------------------------------------------------- MarkMLl · 2021-10-11 09:05 I'd suggest using the dump/restore facilities provided by PostgreSQL. You're unlikely to improve on the performance, and they're using subtlety that you won't necessarily get on a generic API to do the job thoroughly. Something like Code: Bash  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i #! /bin/bash # Note that the dump always generates a file named for the local machine. That# way even if the customised backup.ftp gets copied to the wrong system files# won't overwrite each other. MarkMLl. export HOSTNAME=`/bin/hostname` export DUMP_OPTIONS='--clean --oids'export COPY_TARGET=/export/pgsql-backup # The environment may be empty if this is in crontab. export PATH=/usr/bin:/binexport HOME=/var/lib/postgresql # Generate the backup and copy to the target. pg_dumpall $DUMP_OPTIONS 2>/var/log/pgsql-backup | /bin/gzip >$HOME/$HOSTNAME.gz  MarkMLl ---------------------------------------------------------------------- Thaddy · 2021-10-11 10:16 Mark, You can at least write "Code: Bash  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i " ---------------------------------------------------------------------- loaded · 2021-10-11 10:31 MarkMLl and Thaddy thank you very much for the reply. Also, thank you for sharing your experience. This experience is also very valuable to me. ---------------------------------------------------------------------- MarkMLl · 2021-10-11 10:53 Quote from: Thaddy on October 11, 2021, 12:16:49 pmMark, You can at least write "Code: Bash  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i " Ah, I was about to ask for explanation since that didn't show up properly... you could at least have used the markup that prevents markup from marking up. Whatever it is. I admit that I don't always remember that some people consider shell scripting to be a language and that it's handled by SMF :-) MarkMLl