Обсуждение: values from txid_current()

Поиск
Список
Период
Сортировка

values from txid_current()

От
"Sahagian, David"
Дата:
Using 9.1.3
 
Start Transaction; DO $$ BEGIN raise info '%', txid_current(); END $$; ALTER TABLE MyCoolTable_1 DISABLE TRIGGER trg_foo_1 ; Commit;
Start Transaction;                                                     ALTER TABLE MyCoolTable_2 DISABLE TRIGGER trg_foo_2 ; Commit;
Start Transaction; DO $$ BEGIN raise info '%', txid_current(); END $$; ALTER TABLE MyCoolTable_3 DISABLE TRIGGER trg_foo_3 ; Commit;
Start Transaction;                                                     ALTER TABLE MyCoolTable_4 DISABLE TRIGGER trg_foo_4 ; Commit;
Start Transaction; DO $$ BEGIN raise info '%', txid_current(); END $$; ALTER TABLE MyCoolTable_5 DISABLE TRIGGER trg_foo_5 ; Commit;
 
Why are the Messages displayed by my pgAdmin sql window like this . . .
INFO:  7902
INFO:  7903
INFO:  7904
instead of what I expected . . .
INFO:  7902
INFO:  7904
INFO:  7906
???
 
Thanks,
-dvs-
 
 

Re: values from txid_current()

От
Pavan Deolasee
Дата:


On Wed, Sep 5, 2012 at 10:53 PM, Sahagian, David <david.sahagian@emc.com> wrote:

 
Why are the Messages displayed by my pgAdmin sql window like this . . .
INFO:  7902
INFO:  7903
INFO:  7904
instead of what I expected . . .
INFO:  7902
INFO:  7904
INFO:  7906
???
 

Are you sure those ALTER TABLE commands are executing without an error ? The only way I can see you get those messages is when ALTER TABLE for tables MyCoolTable_2 and MyCoolTable_4 (and possibly others too) are failing for some reason.  

Thanks,
Pavan

Re: values from txid_current()

От
"Sahagian, David"
Дата:

OK, now I will answer my own question.

 

It seems that

  ALTER TABLE MyCoolTable_1 DISABLE TRIGGER trg_foo_1 ;

is a no-op when it is currently disabled.

 

And so no "txn id" is "needed".

 

When I alternate DISable and ENable statements, it behaves as I expect . . .

 

Start Transaction; DO $$ BEGIN raise info '%', txid_current(); END $$; ALTER TABLE MyCoolTable_1 DISABLE TRIGGER trg_foo_1 ; Commit;

Start Transaction;                                                     ALTER TABLE MyCoolTable_1 ENABLE  TRIGGER trg_foo_1 ; Commit;

Start Transaction; DO $$ BEGIN raise info '%', txid_current(); END $$; ALTER TABLE MyCoolTable_1 DISABLE TRIGGER trg_foo_1 ; Commit;

Start Transaction;                                                     ALTER TABLE MyCoolTable_1 ENABLE  TRIGGER trg_foo_1 ; Commit;

Start Transaction; DO $$ BEGIN raise info '%', txid_current(); END $$; ALTER TABLE MyCoolTable_1 DISABLE TRIGGER trg_foo_1 ; Commit;

Start Transaction;                                                     ALTER TABLE MyCoolTable_1 ENABLE  TRIGGER trg_foo_1 ; Commit;

 

INFO:  7958

INFO:  7960

INFO:  7962

 

Thanks,

-dvs-

 

From: Pavan Deolasee [mailto:pavan.deolasee@gmail.com]
Sent: Wednesday, September 05, 2012 1:46 PM
To: Sahagian, David
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] values from txid_current()

 

 

On Wed, Sep 5, 2012 at 10:53 PM, Sahagian, David <david.sahagian@emc.com> wrote:

 

 

Why are the Messages displayed by my pgAdmin sql window like this . . .

INFO:  7902

INFO:  7903

INFO:  7904

instead of what I expected . . .

INFO:  7902

INFO:  7904

INFO:  7906

???

 

 

Are you sure those ALTER TABLE commands are executing without an error ? The only way I can see you get those messages is when ALTER TABLE for tables MyCoolTable_2 and MyCoolTable_4 (and possibly others too) are failing for some reason.  

 

Thanks,

Pavan