Dict issue with PostgreSQL for last_login plugin (duplicate key)

mabi mabi at protonmail.ch
Mon May 20 09:34:41 EEST 2019


‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Sunday, May 19, 2019 10:45 PM, John Fawcett via dovecot <dovecot at dovecot.org> wrote:

> so basically if this works just as well:
>
> INSERT INTO last_logins (last_login,username,domain) VALUES (1558273000,'user at domain.tld','domain.tld') ON CONFLICT DO UPDATE SET last_login=1558273000,domain='domain.tld';
>
> then the fix can be altered to attached file which is more similar to the MYSQL syntax and does not require extra logic to get the username field.

Unfortunately this query does not work, it looks like it really requires the column name as you can see below from the error message:

ERROR:  ON CONFLICT DO UPDATE requires inference specification or constraint name
LINE 1: ...ain) VALUES (1558273000,'user at domain.tld','domain.tld') ON CONFLIC...
                                                             ^
HINT:  For example, ON CONFLICT (column_name).

But if you can use the table's primary key as default for the column name as you mention in your other mail then that should work. I am using here PostgreSQL 10.5 by the way.

I still haven't figured out yet how to recompile properly Dovecot on OpenBSD with your patch but I will give it another shot tonight.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://dovecot.org/pipermail/dovecot/attachments/20190520/6cc22694/attachment.html>


More information about the dovecot mailing list