Re: How to watch for schema changes

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Igor Korot <ikorot01(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to watch for schema changes
Date: 2018-12-04 01:37:08
Message-ID: f513883c-dce5-0f3f-56b5-85f8bb969047@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 12/3/18 5:29 AM, Igor Korot wrote:
> Hi, Adrian,
>
> On Mon, Dec 3, 2018 at 5:15 PM Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> wrote:
>>
>> On 12/3/18 3:00 PM, Igor Korot wrote:
>>> Hi, Adrian,
>>>

>>>
>>> What I mean to say was "no schema changes/server changes that comes
>>> independently
>>> of the program install". Or something to that extent.
>>
>> Which circles back around to the same question:
>>
>> If there are to be no schema changes after the install why track them on
>> subsequent connections?
>>
>> Or maybe an explanation of what you are trying to achieve would make
>> things clearer?
>
> Ok, it probably will make things clearer.
> So I install my program perform some queries and exit.
> At the same time if the user will create or delete a table the program should
> pick up those changes and act accordingly.

So do you want the user to change the schema?

Or could you use permissions to stop that?

I am just seeing a difficult problem trying to divine user intent from
schema changes.

>
> I was hoping to do the watching initialization dynamically, but it looks as it
> is more pain and I can probably try to execute the script during the
> installation.
>
> So basically I will create the function in C, compile it and then
> during the program installation
> create a trigger with that function.
> Then in my program I will execute "LISTEN" command and act accordingly.
>
> Am I right?

Not sure I have never tried LISTEN on event trigger output.

>
> And executing LISTEN will also work for ODBC connection, right?

Again not something I am familiar with. Someone else on this list may be
able to answer that. Or there is:

https://www.postgresql.org/list/pgsql-odbc/

>
> Thank you.
>
>>
>>
>>
>>>
>>> Sorry, ESL person here.
>>>
>>> Thank you.
>>>
>>>>
>>>>>
>>>>> But I will probably create it on every connection and delete on the
>>>>> disconnect (see above).
>>>>>
>>>>
>>>> --
>>>> Adrian Klaver
>>>> adrian(dot)klaver(at)aklaver(dot)com
>>>
>>
>>
>> --
>> Adrian Klaver
>> adrian(dot)klaver(at)aklaver(dot)com
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Igor Neyman 2018-12-04 14:20:21 RE: How to watch for schema changes
Previous Message Adrian Klaver 2018-12-03 23:15:50 Re: How to watch for schema changes