passman icon indicating copy to clipboard operation
passman copied to clipboard

Passman on Nextcloud (database PostgreSQL)

Open ijurisic opened this issue 7 years ago • 7 comments
trafficstars

Bug report

Not support PostgreSQL

Steps to reproduce

  1. When trying to add Passman to Nextcloud can't to add (if have PostgreSQL - on MySql work)

Expected behaviour

I relly love passman and hope passman will add support for PostgreSQL database.

Actual behaviour

Tell us what happens instead

Configuration

Operating system: Debian 9 GNU/Linux

Browser: Waterfox

Extensions that might cause interference:

Passman version:

Operating system: Debian 9 GNU/Linux

Web server: Apache

Database: PostgreSQL

PHP version: 7.0

cloud server: Nextcloud

cloud version: 12.0.4

Cloud log

Cloud log
{"reqId":"es9mToE2Ydvuy0BgdnPI","level":3,"time":"2018-01-19T09:15:31+00:00","remoteAddr":"192.168.4.226","user":"ivan","app":"core","method":"POST","url":"\/index.php\/settings\/ajax\/enableapp.php","message":"An exception occurred while executing 'ALTER TABLE oc_passman_share_request ALTER item_id TYPE BIGINT':\n\nSQLSTATE[42804]: Datatype mismatch: 7 ERROR:  column \"item_id\" cannot be cast automatically to type bigint\nHINT:  You might need to specify \"USING item_id::bigint\".","userAgent":"Mozilla\/5.0 (X11; Linux x86_64; rv:56.0) Gecko\/20100101 Firefox\/56.0.3 Waterfox\/56.0.3","version":"12.0.4.3"}


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

ijurisic avatar Jan 19 '18 09:01 ijurisic

This is a workaround that I've been using to use Nextcloud/Passman with PostgreSQL from this comment:

Suggested solution: PostgreSqlSchemaManager.php line 292:

    $data = $this->_conn->fetchAll('SELECT min_value, increment_by FROM ' . $this->_platform->quoteIdentifier($sequenceName));

to:

    $version = floatval($this->_conn->getWrappedConnection()->getServerVersion());

    if ($version >= 10) {
       $data = $this->_conn->fetchAll('SELECT min_value, increment_by FROM pg_sequences WHERE schemaname = \'public\' AND sequencename = '.$this->_conn->quote($sequenceName));
    }
    else
    {
        $data = $this->_conn->fetchAll('SELECT min_value, increment_by FROM ' . $this->_platform->quoteIdentifier($sequenceName));
    }

synthead avatar Jan 25 '18 06:01 synthead

In my case workaround not help.

{"reqId":"VBhvev1rdXhWyOj1MnLU","level":3,"time":"2018-01-26T10:50:28+00:00","remoteAddr":"192.168.4.237","user":"ivan","app":"core","method":"POST","url":"\/index.php\/settings\/ajax\/enableapp.php","message":"An exception occurred while executing 'ALTER TABLE oc_passman_share_request ALTER item_id TYPE BIGINT':\n\nSQLSTATE[42804]: Datatype mismatch: 7 ERROR: column \"item_id\" cannot be cast automatically to type bigint\nHINT: You might need to specify \"USING item_id::bigint\".","userAgent":"Mozilla\/5.0 (X11; Linux x86_64; rv:56.0) Gecko\/20100101 Firefox\/56.0.3 Waterfox\/56.0.3","version":"12.0.5.3"}

ijurisic avatar Jan 26 '18 10:01 ijurisic

How did you generate that error?

synthead avatar Feb 09 '18 18:02 synthead

Error got when hit button "Enable" in Apps->Your Apps on Passman

Screenshot https://s7.postimg.cc/wtakfpbpn/passman.png

ijurisic avatar May 04 '18 07:05 ijurisic

That's interesting because I have been using Passman with a Nextcloud 13 using a postgres 10 for a while without any issues now... what versions of PostgreSQL are you using ?

madmath03 avatar May 28 '18 09:05 madmath03

PostgreSQL 9.4.15 from official Debian Jessie repository.

ijurisic avatar May 28 '18 10:05 ijurisic

I just got the same error, or almost the same.

I could enable/install it (maybe it throw this log, but didn't see it)

I could create a vault, but when I try to save a password, I see this error:

DriverException","Message":"An exception occurred while executing 'SELECT * FROM \"passman_credentials\" WHERE \"id\" = ?' with params [\"null\"]:\n\nSQLSTATE[22P02]: Invalid text representation: 7 ERROR:  invalid input syntax for type bigint: \"null\""

I guess it is related. (if it is not, then let's me know, I'll open a new issue).

pierreozoux avatar Oct 27 '20 16:10 pierreozoux