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

Schema creation fails when using Postgresql Sink #2184

Open
ueba-yuki opened this issue Jul 4, 2022 · 2 comments
Open

Schema creation fails when using Postgresql Sink #2184

ueba-yuki opened this issue Jul 4, 2022 · 2 comments

Comments

@ueba-yuki
Copy link

ueba-yuki commented Jul 4, 2022

When using Postgresql, the creation of the database schema fails.
This occurs when there is no database matching the PostgreSQL user name.

As a specification of the Postgresql driver, if a connection is made without specifying a database name, it will attempt to connect to a database that matches the user name.
The first time data is transferred using PostgreSQL Sink, it attempts to create a schema, but the code does not specify a database name and attempts to connect to a database that matches the user name.
Therefore, if there is no database matching the user name, the connection creation will fail.

https://github.com/telefonicaid/fiware-cygnus/blob/master/cygnus-common/src/main/java/com/telefonica/iot/cygnus/backends/sql/SQLBackendImpl.java#L143

In the default state, the user name and database name are both postgres, so this bug is not noticed.

https://github.com/telefonicaid/fiware-cygnus/blob/master/cygnus-ngsi-ld/src/main/java/com/telefonica/iot/cygnus/sinks/NGSIPostgreSQLSink.java#L47

@AlvaroVega
Copy link
Member

AlvaroVega commented Jul 27, 2022

Could you please provide which configuration are you using for postgresql sink ?

@AlvaroVega
Copy link
Member

Could you please provide a link in postgresql driver documentation which describes this behavior "As a specification of the Postgresql driver, if a connection is made without specifying a database name, it will attempt to connect to a database that matches the user name." ?

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

No branches or pull requests

2 participants