PQConnection.Params.Add lazarus / 16-Databases ---------------------------------------------------------------------- tatamata · 2017-09-18 18:53 Hello, where can I find explanation of PQConnection.Params.Add? What parameters can be added? Is there any example? ---------------------------------------------------------------------- goodname · 2017-09-19 12:15 Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i PQConn.Para ms.Add('port=5432');PQConn.Open;https://www.postgresql.org/docs/curren t/static/libpq-connect.html#LIBPQ-PARAMKEYWORDS ---------------------------------------------------------------------- LacaK · 2017-09-27 05:41 I have added link also to http://wiki.freepascal.org/postgres#SQLDB ---------------------------------------------------------------------- tatamata · 2017-09-27 10:28 Quote from: LacaK on September 27, 2017, 07:41:22 amI have added link also to http://wiki.freepascal.org/postgres#SQLDB Thanks! ---------------------------------------------------------------------- tatamata · 2017-10-22 20:54 What exactly happens if I set parameter "keepalives" to zero (keepalives=0)? 1. Does it mean that the Postgresql server will never terminate idle sessions? 2. Does it mean that Postgresql server will never terminate Postgresql sessions from closed Lazarus applications? 3. Does it mean that the Postgresql server will never terminate Postgresql sessions from client Lazarus application if network connection is broken? ---------------------------------------------------------------------- goodname · 2017-10-24 12:30 It is likely that nobody on this forum has used the "keepalives" parameter. A quick look through the PostgreSQL documentation didn't really clarify what would happen. Your either going to have to try it and see what happens, do a more in depth web search, or ask on the PostgreSQL mailing list.  https://www.postgresql.org/list/pgsql- general/ ---------------------------------------------------------------------- tatamata · 2023-06-29 08:02 I put into the PQConnection's Params property following string: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i connect_tim eout=180keepalives=1keepalives_idle=86400keepalives_interval=10keepali ves_count=100options=-c statement_timeout=2147483647 -c lock_timeout=2147483647 The last row for statement_timeout and lock_timeout raises an error. I tried then with: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i connect_tim eout=180keepalives=1keepalives_idle=86400keepalives_interval=10keepali ves_count=100statement_timeout=2147483647lock_timeout=2147483647 But again, these two parameters (statement_timeout and lock_timeout) are not recognized. Do you know how to add them properly? I know that I can set it through code in this way: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i // Set statement timeoutpqconnection1.ExecuteDirect('SET statement_timeout = 2147483647');// Set lock timeoutpqconnection1.ExecuteDirect('SET lock_timeout = 2147483647');         But I would like to set it through GUI... ---------------------------------------------------------------------- Zvoni · 2023-06-29 09:29 and if you've actually read the link: https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ- PARAMKEYWORDS you would have seen, that both "Parameters" are not connection-Params, but Server-Parameter/System-Variables inside the pg.conf (or whatever it's called) ---------------------------------------------------------------------- Zvoni · 2023-06-29 09:38 Quote from: tatamata on October 22, 2017, 10:54:00 pmWhat exactly happens if I set parameter "keepalives" to zero (keepalives=0)? 1. Does it mean that the Postgresql server will never terminate idle sessions? 2. Does it mean that Postgresql server will never terminate Postgresql sessions from closed Lazarus applications? 3. Does it mean that the Postgresql server will never terminate Postgresql sessions from client Lazarus application if network connection is broken? Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i keepalives= 1keepalives_idle=86400keepalives_interval=10keepalives_count=100 Line 1: activate "keepalives" (is also defaultvalue) on the CLIENT Line 2: after 86400 seconds (24 hours) of "idle" on that TCP-CLIENT- Connection, send out a "Hey, i'm alive" to the Server Line 3: if a "I'm alive"-Message has NOT been acknowledged by the Server back to the CLIENT, resend that message after 10 seconds Line 4: if Line 3 fails a 100 times, that CLIENT-connection to the Server is considered dead Have a guess on which side of the Client-server equation we are with that..... ---------------------------------------------------------------------- tatamata · 2023-06-29 11:23 Quote from: Zvoni on June 29, 2023, 11:29:24 amand if you've actually read the link: https://www.postgresql.org/docs/current/libpq- connect.html#LIBPQ-PARAMKEYWORDS you would have seen, that both "Parameters" are not connection-Params, but Server-Parameter/System-Variables inside the pg.conf (or whatever it's called) Zvoni, nevrtheless, if I set it this way, through Lazarus client program: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i // Set statement timeoutpqconnection1.ExecuteDirect('SET statement_timeout = 2147483647');// Set lock timeoutpqconnection1.ExecuteDirect('SET lock_timeout = 2147483647');  what is the scope of validity of this settings? Would it last until the pqconnection is closed? Will it be valid for all queries being executed via this connection? ---------------------------------------------------------------------- tatamata · 2023-06-29 11:25 Quote from: Zvoni on June 29, 2023, 11:38:30 amQuote from: tatamata on October 22, 2017, 10:54:00 pmWhat exactly happens if I set parameter "keepalives" to zero (keepalives=0)? 1. Does it mean that the Postgresql server will never terminate idle sessions? 2. Does it mean that Postgresql server will never terminate Postgresql sessions from closed Lazarus applications? 3. Does it mean that the Postgresql server will never terminate Postgresql sessions from client Lazarus application if network connection is broken? Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i keepalives= 1keepalives_idle=86400keepalives_interval=10keepalives_count=100 Line 1: activate "keepalives" (is also defaultvalue) on the CLIENT Line 2: after 86400 seconds (24 hours) of "idle" on that TCP-CLIENT- Connection, send out a "Hey, i'm alive" to the Server Line 3: if a "I'm alive"-Message has NOT been acknowledged by the Server back to the CLIENT, resend that message after 10 seconds Line 4: if Line 3 fails a 100 times, that CLIENT-connection to the Server is considered dead Have a guess on which side of the Client-server equation we are with that..... Thanks, this was nice explanation. ---------------------------------------------------------------------- Zvoni · 2023-06-29 11:36 Quote from: tatamata on June 29, 2023, 01:23:32 pmQuote from: Zvoni on June 29, 2023, 11:29:24 amand if you've actually read the link: https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ- PARAMKEYWORDS you would have seen, that both "Parameters" are not connection-Params, but Server-Parameter/System-Variables inside the pg.conf (or whatever it's called) Zvoni, nevrtheless, if I set it this way, through Lazarus client program: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i // Set statement timeoutpqconnection1.ExecuteDirect('SET statement_timeout = 2147483647');// Set lock timeoutpqconnection1.ExecuteDirect('SET lock_timeout = 2147483647');  what is the scope of validity of this settings? Would it last until the pqconnection is closed? Will it be valid for all queries being executed via this connection? As far as i understand it: They would remain that way at least until the next Server-Reboot, since those are System/Server-Variables. Worst case: They overwrite the values in the pg.conf with those values, and all clients to that server have then to "suffer" those values from then on. But: I'm not a PG-Expert, but i do know my way around server-based DBMS. User-Rights/Grants not withstanding of course!