Re-to-archived-thread: Dict issue with PostgreSQL for last_login plugin (duplicate key)

2020-04-23 Thread lists
Hi, I have tried to implement last_login with PostgreSQL and I found an old thread from June 2019. I have found a simple solution that I want to share with you: I followed the instructions on how to set up a last_login on the official documentation. Therefor I creates a very simple table

Re: Dict issue with PostgreSQL for last_login plugin (duplicate key)

2019-05-29 Thread mabi via dovecot
‐‐‐ Original Message ‐‐‐ On Wednesday, May 29, 2019 8:01 AM, Aki Tuomi wrote: > We'll take this under consideration, but no promises. Thank you very much Aki for consdering this. It would be really fair for all the PostgreSQL users out there.

Re: Dict issue with PostgreSQL for last_login plugin (duplicate key)

2019-05-29 Thread Zhang Huangbin via dovecot
> On May 29, 2019, at 2:01 PM, Aki Tuomi via dovecot > wrote: > > We'll take this under consideration, but no promises. Dear Aki, I reported this issue and request before: https://marc.info/?t=15541153161=1=2 Hope we can have this feature soon. :) Thank you very much.

Re: Dict issue with PostgreSQL for last_login plugin (duplicate key)

2019-05-29 Thread Aki Tuomi via dovecot
On 28.5.2019 22.34, mabi via dovecot wrote: > ‐‐‐ Original Message ‐‐‐ > On Monday, May 20, 2019 12:37 AM, John Fawcett via dovecot > wrote: > >> there's no field name that is obviously the primary key. I've >> reworked the patch to use the postgres default primary key constraint >> name

Re: Dict issue with PostgreSQL for last_login plugin (duplicate key)

2019-05-28 Thread mabi via dovecot
‐‐‐ Original Message ‐‐‐ On Monday, May 20, 2019 12:37 AM, John Fawcett via dovecot wrote: > there's no field name that is obviously the primary key. I've reworked the > patch to use the postgres default primary key constraint name > (tablename_pkey). > > The attached fix should work

Re: more generic approach as for userdb? (was: Dict issue with PostgreSQL for last_login plugin (duplicate key))

2019-05-23 Thread John Fawcett via dovecot
On 23/05/2019 07:49, Steffen Kaiser via dovecot wrote: > On Wed, 22 May 2019, John Fawcett via dovecot wrote: > > > an update when insert fails seems to be a MySQL specific extension to > > standard Sql. So I think that it's clear that support for PostgreSql and > > Sqlite  needs to be

Re: more generic approach as for userdb? (was: Dict issue with PostgreSQL for last_login plugin (duplicate key))

2019-05-23 Thread Aki Tuomi via dovecot
> Maybe, one should drop the automatic at all and let the user specify > the commands manually like with the userdb/passwd. Hence, the generic > SQL preparation code is already present. There could/should/would be > documented lots of "best practice" settings for various backends. > > In fact,

more generic approach as for userdb? (was: Dict issue with PostgreSQL for last_login plugin (duplicate key))

2019-05-22 Thread Steffen Kaiser via dovecot
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Wed, 22 May 2019, John Fawcett via dovecot wrote: an update when insert fails seems to be a MySQL specific extension to standard Sql. So I think that it's clear that support for PostgreSql and Sqlite  needs to be implemented. The same issue

Re: Dict issue with PostgreSQL for last_login plugin (duplicate key)

2019-05-22 Thread John Fawcett via dovecot
On 21/05/2019 15:45, mabi via dovecot wrote: > ‐‐‐ Original Message ‐‐‐ > On Monday, May 20, 2019 12:37 AM, John Fawcett via dovecot > wrote: > >> So looking into this with a postgresql databse to work with: the >> above query does not work. You have to specify either the column name >>

Re: Dict issue with PostgreSQL for last_login plugin (duplicate key)

2019-05-21 Thread mabi via dovecot
‐‐‐ Original Message ‐‐‐ On Monday, May 20, 2019 12:37 AM, John Fawcett via dovecot wrote: > So looking into this with a postgresql databse to work with: the above query > does not work. You have to specify either the column name or the constraint > name that you expect to be violated

Re: Dict issue with PostgreSQL for last_login plugin (duplicate key)

2019-05-20 Thread mabi via dovecot
‐‐‐ Original Message ‐‐‐ On Sunday, May 19, 2019 10:45 PM, John Fawcett via dovecot wrote: > so basically if this works just as well: > > INSERT INTO last_logins (last_login,username,domain) VALUES > (1558273000,'u...@domain.tld','domain.tld') ON CONFLICT DO UPDATE SET >

Re: Dict issue with PostgreSQL for last_login plugin (duplicate key)

2019-05-19 Thread John Fawcett via dovecot
On 19/05/2019 22:45, John Fawcett via dovecot wrote: > On 19/05/2019 22:37, John Fawcett via dovecot wrote: >> On 19/05/2019 20:31, mabi via dovecot wrote: >>> >>> ‐‐‐ Original Message ‐‐‐ >>> On Sunday, May 19, 2019 7:36 PM, John Fawcett via dovecot >>> wrote: Attached is a

Re: Dict issue with PostgreSQL for last_login plugin (duplicate key)

2019-05-19 Thread John Fawcett via dovecot
On 19/05/2019 22:37, John Fawcett via dovecot wrote: > On 19/05/2019 20:31, mabi via dovecot wrote: >> >> ‐‐‐ Original Message ‐‐‐ >> On Sunday, May 19, 2019 7:36 PM, John Fawcett via dovecot >> wrote: >>> >>> Attached is a tentative patch. I've verified no regression for >>> mysql. There

Re: Dict issue with PostgreSQL for last_login plugin (duplicate key)

2019-05-19 Thread John Fawcett via dovecot
On 19/05/2019 20:31, mabi via dovecot wrote: > > ‐‐‐ Original Message ‐‐‐ > On Sunday, May 19, 2019 7:36 PM, John Fawcett via dovecot > wrote: >> >> Attached is a tentative patch. I've verified no regression for mysql. >> There should be no regression for sqlite as the code path is

Re: Dict issue with PostgreSQL for last_login plugin (duplicate key)

2019-05-19 Thread mabi via dovecot
‐‐‐ Original Message ‐‐‐ On Sunday, May 19, 2019 7:36 PM, John Fawcett via dovecot wrote: > Attached is a tentative patch. I've verified no regression for mysql. There > should be no regression for sqlite as the code path is identical. > > Are you able to test for pgsql? As mentioned

Re: Dict issue with PostgreSQL for last_login plugin (duplicate key)

2019-05-19 Thread John Fawcett via dovecot
On 19/05/2019 17:08, mabi via dovecot wrote: > ‐‐‐ Original Message ‐‐‐ > On Sunday, May 19, 2019 4:44 PM, John Fawcett via dovecot > wrote: > >> I don't have PostgresSql, would you be able to verify if this syntax >> would work: INSERT INTO last_logins (last_login,username,domain) >>

Re: Dict issue with PostgreSQL for last_login plugin (duplicate key)

2019-05-19 Thread mabi via dovecot
‐‐‐ Original Message ‐‐‐ On Sunday, May 19, 2019 4:44 PM, John Fawcett via dovecot wrote: > I don't have PostgresSql, would you be able to verify if this syntax would > work: INSERT INTO last_logins (last_login,username,domain) VALUES > (1558273000,'u...@domain.tld','domain.tld') ON

Re: Dict issue with PostgreSQL for last_login plugin (duplicate key)

2019-05-19 Thread John Fawcett via dovecot
On 19/05/2019 16:25, John Fawcett via dovecot wrote: > INSERT INTO last_logins (last_login,username,domain) VALUES > (1558273000,'u...@domain.tld','domain.tld') I don't have PostgresSql, would you be able to verify if this syntax would work: INSERT INTO last_logins (last_login,username,domain)

Re: Dict issue with PostgreSQL for last_login plugin (duplicate key)

2019-05-19 Thread mabi via dovecot
‐‐‐ Original Message ‐‐‐ On Sunday, May 19, 2019 3:57 PM, Aki Tuomi wrote: > It would be a feature request, also note that it's only available since > version 9.5, so it really won't help anyone before that. Would opening an issue as feature request on GitHub on the dovecot/core

Re: Dict issue with PostgreSQL for last_login plugin (duplicate key)

2019-05-19 Thread John Fawcett via dovecot
On 19/05/2019 15:42, mabi via dovecot wrote: > ‐‐‐ Original Message ‐‐‐ > On Sunday, May 19, 2019 2:58 PM, John Fawcett via dovecot > wrote: > >> I guess it is not supported for PostgreSQL or Sqlite, since they don't >> have "ON DUPLICATE KEY UPDATE" statement which is what is being used

Re: Dict issue with PostgreSQL for last_login plugin (duplicate key)

2019-05-19 Thread Aki Tuomi via dovecot
> On 19 May 2019 16:42 mabi via dovecot wrote: > > > ‐‐‐ Original Message ‐‐‐ > On Sunday, May 19, 2019 2:58 PM, John Fawcett via dovecot > wrote: > > > I guess it is not supported for PostgreSQL or Sqlite, since they don't > > have "ON DUPLICATE KEY UPDATE" statement which is

Re: Dict issue with PostgreSQL for last_login plugin (duplicate key)

2019-05-19 Thread mabi via dovecot
‐‐‐ Original Message ‐‐‐ On Sunday, May 19, 2019 2:58 PM, John Fawcett via dovecot wrote: > I guess it is not supported for PostgreSQL or Sqlite, since they don't > have "ON DUPLICATE KEY UPDATE" statement which is what is being used in > MySQL. That's it, PostgreSQL does not have "ON

Re: Dict issue with PostgreSQL for last_login plugin (duplicate key)

2019-05-19 Thread John Fawcett via dovecot
On 19/05/2019 12:52, mabi via dovecot wrote: > Hello, > > I am trying to setup the last_login plugin on Dovecot 2.3 in order to log a > user's last IMAP login into a separate PostgreSQL table called last_login. I > am actually following that guide: >

Dict issue with PostgreSQL for last_login plugin (duplicate key)

2019-05-19 Thread mabi via dovecot
Hello, I am trying to setup the last_login plugin on Dovecot 2.3 in order to log a user's last IMAP login into a separate PostgreSQL table called last_login. I am actually following that guide: https://docs.iredmail.org/track.user.last.login.html with the exception that I use PostgreSQL