Re : Global value/global variable?

From: Edson Richter <edsonrichter(at)hotmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re : Global value/global variable?
Date: 2014-06-19 14:39:45
Message-ID: BLU436-SMTP68A827DE19B03E0D7C2563CF130@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

<span style="font-size:10pt;"><p style="margin-top:0;margin-bottom:0;">Yes. It's similar, but consider I'm using a connection pool, so I''ve no control on when the connections are established/destroyed.</p><p style="margin-top:0;margin-bottom:0;">I think I need something with scope broader than session...</p><p style="margin-top:0;margin-bottom:0;">&nbsp;</p><dev3_jjy>Atenciosamente,<br><br>Edson Richter&nbsp;</dev3_jjy><br><br>------ Mensagem original ------<br><b>De:&nbsp;</b>John McKown<john(dot)archie(dot)mckown(at)gmail(dot)com><br><b>Data:&nbsp;</b>19/06/2014 8h44<br><b>Para:&nbsp;</b>Edson Richter;<br><b>Assunto:</b>Re: [GENERAL] Global value/global variable?<br><br><div dir="ltr">A psql session is shown below:<div><br></div><div><div>tsh009=# \set lpar '\'LIH1\''</div><div>tsh009=# select * from capped where lpar=:lpar limit 5;</div><div>&nbsp;lpar | &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;started &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ended &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
<div>------+---------------------+---------------------</div><div>&nbsp;LIH1 | 2014-06-09 21:57:13 | 2014-06-09 22:21:21</div><div>&nbsp;LIH1 | 2014-06-09 22:42:12 | 2014-06-09 23:06:22</div><div>&nbsp;LIH1 | 2014-06-09 23:22:12 | 2014-06-09 23:39:12</div>
<div>&nbsp;LIH1 | 2014-06-09 23:52:12 | 2014-06-10 00:01:21</div><div>&nbsp;LIH1 | 2014-06-10 01:07:11 | 2014-06-10 01:07:51</div><div>(5 rows)</div></div><div><br></div><div><br></div><div>Is this close to what you are looking for?</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jun 18, 2014 at 9:50 PM, Edson Richter&nbsp;<span dir="ltr">&lt;<a href="mailto:edsonrichter(at)hotmail(dot)com" target="_blank">edsonrichter(at)hotmail(dot)com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div><div dir="ltr">It is possible to define a global value/variable in PostgreSQL in a way that I can use it in any query/view/function?<div>For example, I do have a connection string I use for dblink connections in several places (specially, inside views).</div>
<div>Then, if I want to change the connection string, I do have to change every view manually.</div><div>If I can set a kind of global variable, then I just use it inside every view - then, at my application startup (or even at PostgreSQL startup, if I can set this string at postgresql.conf level), would set this &quot;global variable&quot; to point the current string.</div>
<div><br></div><div>Your enlightment will be really welcome.</div><div><br></div><div>Regards,</div><div><br></div><div>Edson</div><div><br></div> </div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><div>There is nothing more pleasant than traveling and meeting new people!<br></div>Genghis Khan<br><div><br><div><div><div>Maranatha! &lt;&gt;&lt;<br>
John McKown<br></div></div></div></div></div>
</div>

</span>

Attachment Content-Type Size
unknown_filename text/html 2.9 KB

Responses

Browse pgsql-general by date

  From Date Subject
Next Message sunpeng 2014-06-19 14:41:58 Re: How to store fixed size images?
Previous Message Larry J Prikockis 2014-06-19 14:24:04 pros/cons of using "synchronous commit=off" - AWS in particular