gnumed-bugs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnumed-bugs] Fixup Server failed


From: Karsten Hilbert
Subject: Re: [Gnumed-bugs] Fixup Server failed
Date: Thu, 5 Sep 2019 15:12:52 +0200

OK, so we have established that, indeed, the PRIMARY KEY
constraint is gone for good by the fix.

So, let's add it back:

SET default_transaction_read_only to off;
BEGIN;
ALTER TABLE gm.access_log ADD PRIMARY KEY (pk);
\d gm.access_log
ROLLBACK;

Karsten

> Gesendet: Donnerstag, 05. September 2019 um 13:42 Uhr
> Von: address@hidden
> An: "Karsten Hilbert" <address@hidden>
> Cc: address@hidden
> Betreff: Re: [Gnumed-bugs] Fixup Server failed
>
>                                                                     
> Table "gm.access_log"
>     Column     |           Type           | Collation | Nullable
> |                       Default                        | Storage  |
> Stats target | Description
> ---------------+--------------------------+-----------+----------+------------------------------------------------------+----------+--------------+-------------
>  pk_audit      | integer                  |           | not null |
> nextval('audit.audit_fields_pk_audit_seq'::regclass) | plain   
> |              |
>  row_version   | integer                  |           | not null |
> 0                                                    | plain   
> |              |
>  modified_when | timestamp with time zone |           | not null |
> now()                                                | plain   
> |              |
>  modified_by   | name                     |           | not null |
> "current_user"()                                     | plain   
> |              |
>  pk            | integer                  |           | not null |
> nextval('gm.access_log_pk_seq'::regclass)            | plain   
> |              |
>  user_action   | text                     |           | not null
> |                                                      | extended
> |              |
> Check constraints:
>     "audit_audit_fields_sane_modified_when" CHECK ((modified_when <=
> clock_timestamp()) IS TRUE)
>     "non_empty_user_action" CHECK
> (gm.is_null_or_blank_string(user_action) IS FALSE)
> Triggers:
>     zt_del_access_log BEFORE DELETE ON gm.access_log FOR EACH ROW
> EXECUTE PROCEDURE audit.ft_del_access_log()
>     zt_ins_access_log BEFORE INSERT ON gm.access_log FOR EACH ROW
> EXECUTE PROCEDURE audit.ft_ins_access_log()
>     zt_upd_access_log BEFORE UPDATE ON gm.access_log FOR EACH ROW
> EXECUTE PROCEDURE audit.ft_upd_access_log()
> Inherits: audit.audit_fields
> 
> ~
> ~
> 
> Am 05.09.19 um 13:22 schrieb Karsten Hilbert:
> > ah, sorry,
> >
> > \d+ gm.access_log
> >
> > Karsten
> >
> >
> >> Gesendet: Donnerstag, 05. September 2019 um 13:01 Uhr
> >> Von: address@hidden
> >> An: "Karsten Hilbert" <address@hidden>
> >> Cc: address@hidden
> >> Betreff: Re: [Gnumed-bugs] Fixup Server failed
> >>
> >>                                                                         
> >> List of functions
> >>  Schema | Name | Result data type | Argument data types | Type |
> >> Volatility | Parallel | Owner | Security | Access privileges | Language
> >> | Source code | Description
> >> --------+------+------------------+---------------------+------+------------+----------+-------+----------+-------------------+----------+-------------+-------------
> >> (0 rows)
> >>
> >> Am 05.09.19 um 12:46 schrieb Karsten Hilbert:
> >>>> that's why I love GNUmed. Easy solution - and I've learned something.
> >>>>
> >>>> SET default_transaction_read_only to off;
> >>>> BEGIN;
> >>>> ALTER TABLE gm.access_log DROP CONSTRAINT access_log_pkey CASCADE;
> >>>> DROP INDEX if exists gm.access_log_pkey CASCADE;
> >>>> SELECT * FROM gm.access_log WHERE pk = 67314;
> >>>> DELETE FROM gm.access_log WHERE pk_audit = 593072;
> >>>> REINDEX TABLE gm.access_log;
> >>>>
> >>>> that's what solved it!
> >>>>
> >>>> I had to drop the other line, otherwise I somehow got the same error
> >>>> again.
> >>> Well, that last line "ROLLBACK" was there to make sure you
> >>> test things first non-destructively.
> >>>
> >>> The next step would have been to re-run the above with
> >>>
> >>> COMMIT;
> >>>
> >>> appended :-)
> >>>
> >>> Or, one could have refined the script to keep the deleted line
> >>> as a new line such as not to lose it's content (which is just
> >>> a log of one EMR access). Things will run fine w/o it, though.
> >>> The deletion is also logged in the audit system ;-)
> >>>
> >>> We should now re-enable the index and primary key:
> >>>
> >>> What does
> >>>
> >>>  \df+ gm.access_log
> >>>
> >>> show ATM ?
> >>>
> >>> Karsten
> >>>
> >>>
> >>>
> >>>  now gm_fixup_server ran without problems.
> >>>> Thanks
> >>>>
> >>>>
> >>>> Am 04.09.19 um 22:54 schrieb Karsten Hilbert:
> >>>>> On Wed, Sep 04, 2019 at 12:22:43PM +0200, address@hidden wrote:
> >>>>>
> >>>>>>  pk_audit | row_version |         modified_when         | modified_by 
> >>>>>> | 
> >>>>>> pk   |                  user_action                 
> >>>>>> ----------+-------------+-------------------------------+-------------+-------+-----------------------------------------------
> >>>>>>    593072 |           0 | 2019-07-23 06:08:28.608499+00 | maan        |
> >>>>>> 67314 | EMR access: pulling chart for identity [9670]
> >>>>>>    593079 |           0 | 2019-07-23 06:26:59.141724+00 | maan        |
> >>>>>> 67314 | EMR access: pulling chart for identity [9672]
> >>>>>> (2 rows)
> >>>>> One might simply delete one of the rows:
> >>>>>
> >>>>>
> >>>>> SET default_transaction_read_only to off;
> >>>>> BEGIN;
> >>>>> SELECT * FROM gm.access_log WHERE pk = 67314;
> >>>>> DELETE FROM gm.access_log WHERE pk_audit = 593079;
> >>>>> REINDEX TABLE gm.access_log;
> >>>>> ROLLBACK;
> >>>>>
> >>>>> Karsten
> >>>>> --
> >>>>> GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]