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

Support PostgreSQL #221

Merged
merged 25 commits into from
Mar 15, 2022
Merged

Support PostgreSQL #221

merged 25 commits into from
Mar 15, 2022

Conversation

Al2Klimov
Copy link
Member

fixes #136

@Al2Klimov Al2Klimov added enhancement New feature or request area/connection labels Oct 21, 2020
@Al2Klimov Al2Klimov self-assigned this Oct 21, 2020
@Al2Klimov
Copy link
Member Author

@lippserd Please have a look at 9c3982d.

@Al2Klimov Al2Klimov force-pushed the feature/postgres-136 branch 3 times, most recently from 1583341 to 93b73bb Compare October 23, 2020 14:23
@Al2Klimov
Copy link
Member Author

@N-o-X Nice list. How did you collect the items?

@Al2Klimov Al2Klimov force-pushed the feature/postgres-136 branch 2 times, most recently from fdf4775 to eebae88 Compare October 27, 2020 10:56
@Al2Klimov
Copy link
Member Author

Stumbled over lib/pq#1006.

@Thomas-Gelf Have you ever seen any customers insisting on TLS between app and DB?

@Thomas-Gelf
Copy link

@Thomas-Gelf Have you ever seen any customers insisting on TLS between app and DB?

There are some with such policies in place. Usually the wording is not "the DB connection must use TLS", it's more like "the connection to databases or similar services must be encrypted". Policies vary depending on the kind of data being stored. As Custom Vars in the IcingaDB might carry secrets, we usually fall in the "sensible" class.

While TLS is fine for daemons, it is annoying for the web because of the additional latency - "per click". Workarounds include local DB proxies then talking encrypted to the DB or IPSEC as a transport. Often you can also compile a form and check the "not yet, but soon" option 😆

Long story short: yes. And they're probably getting more.

@Al2Klimov
Copy link
Member Author

Thanks, good to know. Cool that we don't have to support TLS directly.

@Thomas-Gelf
Copy link

Thanks, good to know. Cool that we don't have to support TLS directly.

IMHO that shouldn't be the conclusion :D In every project where we didn't offer TLS for DB connections we got issues complaining about that. Therefore I'd strongly suggest to offer it, especially for new projects. Eventually we should not only offer it everywhere, but lead by example - and strongly recommend it for every setup and configuration.

@Al2Klimov Al2Klimov added the needs-feedback We'll only proceed once we hear from you again label Oct 27, 2020
@Al2Klimov Al2Klimov force-pushed the feature/postgres-136 branch 2 times, most recently from d4f639c to c1c804c Compare October 27, 2020 16:48
@Al2Klimov
Copy link
Member Author

As the tests show, it works... theoretically: lib/pq#1007

@N-o-X
Copy link
Contributor

N-o-X commented Oct 28, 2020

@N-o-X Nice list. How did you collect the items?

I think I got that list from @lippserd.

@N-o-X N-o-X removed the needs-feedback We'll only proceed once we hear from you again label Oct 28, 2020
@N-o-X N-o-X removed their assignment Oct 28, 2020
@Al2Klimov Al2Klimov added the needs-feedback We'll only proceed once we hear from you again label Oct 28, 2020
@julianbrost
Copy link
Contributor

What's the current state of this? I think it should probably be merged before #232 or we start thinking in more detail about #234 as anything else would probably result in merge conflicts that can probably be better solved in the context of the other tasks.

@Al2Klimov
Copy link
Member Author

State: Waiting for feedback from @lippserd

@fl0wx
Copy link

fl0wx commented May 25, 2021

What's the status on this issue? Really would love to see postgres support in next release

Al2Klimov and others added 18 commits March 10, 2022 17:04
By the way avoid duplicate rows in the same upsert chunk to avoid Postgres
error 21000 (ON CONFLICT DO UPDATE command cannot affect row a second time).

refs #136
not to require web to LOWER().

refs #136
Before:

idb=# select * from icingadb_instance where responsible = 'y';
ERROR:  operator does not exist: boolenum = unknown
LINE 1: select * from icingadb_instance where responsible = 'y';
                                                          ^
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.
idb=#

refs #136
PostgreSQL does not allow null bytes in varchar, char and
text fields.
@Al2Klimov Al2Klimov force-pushed the feature/postgres-136 branch from 76b447b to b2618de Compare March 10, 2022 16:12
@Al2Klimov
Copy link
Member Author

Full ack. MySQL *nix socket support lack makes this a classic case of other construction area :)

Copy link
Contributor

@julianbrost julianbrost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note to my future self or anyone else coming back to this PR asking who approved this: I still don't think these boolenum and *uint types in the schema are a good idea but I was outvoted there.

@lippserd
Copy link
Member

Just a note to my future self or anyone else coming back to this PR asking who approved this: I still don't think these boolenum and *uint types in the schema are a good idea but I was outvoted there.

Just for the records, what would you propose?

@julianbrost
Copy link
Contributor

The standard boolean type and for integers just the smallest one that fits the required range and maybe some constraints as they make sense (as defined by the constraints given by icinga2, not by the MySQL schema).

But anyways, I didn't want to resume that discussion, GitHub just doesn't allow to get rid of the "changes requested" state without explicit approval.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/connection cla/signed enhancement New feature or request needs-feedback We'll only proceed once we hear from you again
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PostgreSQL support
6 participants