You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spamassassin.apache.org by bu...@bugzilla.spamassassin.org on 2015/05/06 12:15:47 UTC

[Bug 7190] New: txrep_pg.sql is not Postgresql

https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7190

            Bug ID: 7190
           Summary: txrep_pg.sql is not Postgresql
           Product: Spamassassin
           Version: 3.4.1
          Hardware: Sun
                OS: Solaris
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Documentation
          Assignee: dev@spamassassin.apache.org
          Reporter: lista@xdrv.co.uk

txrep_pg.sql is not compatible with postgresql

I used:


CREATE TABLE txrep (
  username varchar(100) NOT NULL default '',
  email varchar(255) NOT NULL default '',
  ip varchar(40) NOT NULL default '',
  count int NOT NULL default '0',
  totscore float NOT NULL default '0',
  signedby varchar(255) NOT NULL default '',
  last_hit timestamp NOT NULL default now(),
  PRIMARY KEY (username,email,signedby,ip)
);


CREATE OR REPLACE FUNCTION update_modified_timestamp()
RETURNS TRIGGER AS $$
BEGIN
    IF (NEW != OLD) THEN
        NEW.last_hit = CURRENT_TIMESTAMP;
        RETURN NEW;
    END IF;
    RETURN OLD;
END;
$$ LANGUAGE plpgsql;


CREATE TRIGGER txrep_last_hit_trigger BEFORE UPDATE
    ON txrep FOR EACH ROW EXECUTE PROCEDURE 
    update_modified_timestamp();



...but please have it checked by someone that specialises in postgresql.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 7190] txrep_pg.sql is not Postgresql

Posted by bu...@bugzilla.spamassassin.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7190

--- Comment #3 from Daniel J. Luke <dl...@geeklair.net> ---
inline for review as well (note that the shipped txrep_pg.sql can't work, so
clearly no one tried it):

CREATE TABLE txrep (
  username varchar(100) NOT NULL default '',
  email varchar(255) NOT NULL default '',
  ip varchar(40) NOT NULL default '',
  count integer NOT NULL default '0',
  totscore float NOT NULL default '0',
  signedby varchar(255) NOT NULL default '',
  last_hit timestamp NOT NULL default CURRENT_TIMESTAMP,
  PRIMARY KEY (username,email,signedby,ip)
);

create index txrep_last_hit on txrep (last_hit);

create OR REPLACE function update_txrep_last_hit()
RETURNS TRIGGER AS $$
BEGIN
  NEW.last_hit = CURRENT_TIMESTAMP;
  RETURN NEW;
END;
$$ language 'plpgsql';

create TRIGGER update_txrep_update_last_hit BEFORE UPDATE 
ON txrep FOR EACH ROW EXECUTE PROCEDURE
update_txrep_last_hit();

ALTER TABLE txrep SET (fillfactor=95);

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 7190] txrep_pg.sql is not Postgresql

Posted by bu...@bugzilla.spamassassin.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7190

Joe Quinn <jq...@pccc.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
                 CC|                            |jquinn+SAbug@pccc.com
             Status|NEW                         |RESOLVED

--- Comment #5 from Joe Quinn <jq...@pccc.com> ---
Committed revision 1688200.
Committed revision 1688201.

A straightforward change that's trivial to anyone who knows Postgres. Fixed.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 7190] txrep_pg.sql is not Postgresql

Posted by bu...@bugzilla.spamassassin.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7190

--- Comment #4 from Daniel J. Luke <dl...@geeklair.net> ---
Note also that the maintenance query in the README.txrep file needs to be
altered for Postgresql. The following works (added quotes around '120 day'):

DELETE FROM txrep WHERE last_hit <= (now() - INTERVAL '120 day');

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 7190] txrep_pg.sql is not Postgresql

Posted by bu...@bugzilla.spamassassin.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7190

Daniel J. Luke <dl...@geeklair.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #5311|application/octet-stream    |text/plain
          mime type|                            |

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 7190] txrep_pg.sql is not Postgresql

Posted by bu...@bugzilla.spamassassin.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7190

Daniel J. Luke <dl...@geeklair.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dluke@geeklair.net

--- Comment #2 from Daniel J. Luke <dl...@geeklair.net> ---
Created attachment 5311
  --> https://bz.apache.org/SpamAssassin/attachment.cgi?id=5311&action=edit
revised txrep_pg.sql

I did something similar.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 7190] txrep_pg.sql is not Postgresql

Posted by bu...@bugzilla.spamassassin.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7190

andrew@topdog.za.net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrew@topdog.za.net

--- Comment #1 from andrew@topdog.za.net ---
You possibly need UNIQUE (last_hit) as well in place of KEY last_hit (last_hit)

-- 
You are receiving this mail because:
You are the assignee for the bug.