Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Postgres Support? #446

Open
stephbaxter opened this issue Mar 7, 2022 · 1 comment
Open

Postgres Support? #446

stephbaxter opened this issue Mar 7, 2022 · 1 comment
Labels

Comments

@stephbaxter
Copy link

stephbaxter commented Mar 7, 2022

Hi
I am connecting to postgresql with a table of type 'hypertable' indexed on 'timeStamp'.

I have created a connection of type SQL advanced. I can retrieve data.

I have created action ADD using Fusio\Adapter\Sql\Action\SqlInsert

When I send the json payload the record IS inserted into the database table BUT I get the following erro:

SQLSTATE[55000]: Object not in prerequisite state: 7 ERROR: lastval is not yet defined in this session in /var/www/html/fusio/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/Exception.php on line 18

This seems to be caused by the way postgresql responds and the absence of an ID field / primary key. (this might help nextcloud/files_antivirus#86).

From the postgresql timeseriesdb docs: You can also specify that INSERT returns some or all of the inserted data via the RETURNING statement:

INSERT INTO conditions
VALUES (NOW(), 'office', 70.1, 50.1) RETURNING *;

Have you experience using postgresql or perhaps have plans to create a postgresql connector type?

Thanks

@chriskapp
Copy link
Member

Hi, ok so in general Fusio and the SQL connection also supports Postgres but it looks like it is a problem regarding the SqlInsert action. In the action we return the last inserted id s. https://github.com/apioo/fusio-adapter-sql/blob/master/src/Action/SqlInsert.php#L57 and it looks like this method produces this error.

Iam not familiar with the postgresql timeseriesdb but it looks like this is an extension to postgres? So Iam not sure whether the problem is related to the extension or whether this also occurs on a plain postgres installation.

Could you maybe provide me your table structure and the JSON which you send to your endpoint, then I could also try to reproduce the problem on a plain postgrest setup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants