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

Compilation failed with postgresql 14.0 #1371

Open
ROBERT-MCDOWELL opened this issue Oct 4, 2021 · 12 comments
Open

Compilation failed with postgresql 14.0 #1371

ROBERT-MCDOWELL opened this issue Oct 4, 2021 · 12 comments
Labels
bug Something isn't working

Comments

@ROBERT-MCDOWELL
Copy link
Contributor

I get this error:

make[4]: Entering directory '/home/src/freeswitch/src/mod/databases/mod_pgsql'
CC mod_pgsql_la-mod_pgsql.lo
mod_pgsql.c: In function ‘pgsql_next_result_timed’:
mod_pgsql.c:758:17: error: enumeration value ‘PGRES_PIPELINE_SYNC’ not handled in switch [-Werror=switch]
758 | switch (res->status) {
| ^~~~~~
mod_pgsql.c:758:17: error: enumeration value ‘PGRES_PIPELINE_ABORTED’ not handled in switch [-Werror=switch]

thanks

@ROBERT-MCDOWELL ROBERT-MCDOWELL added the bug Something isn't working label Oct 4, 2021
@andywolk
Copy link
Contributor

andywolk commented Oct 4, 2021

Will be happy to review your PR.

@ROBERT-MCDOWELL
Copy link
Contributor Author

I dont' know very well mod_pgsql and C language btw, but I'm going to make a try anyway.
here a good info about this new status
https://www.postgresql.org/docs/14/libpq-pipeline-mode.html#LIBPQ-PIPELINE-ERRORS

@shaunjstokes
Copy link
Contributor

shaunjstokes commented Oct 25, 2021

Not sure what the correct behavior should be but we can workaround this with the below patch.

diff --git a/src/mod/databases/mod_pgsql/mod_pgsql.c b/src/mod/databases/mod_pgsql/mod_pgsql.c
index 8c24cf9fce..502eff05c1 100644
--- a/src/mod/databases/mod_pgsql/mod_pgsql.c
+++ b/src/mod/databases/mod_pgsql/mod_pgsql.c
@@ -772,6 +772,8 @@ switch_status_t pgsql_next_result_timed(switch_pgsql_handle_t *handle, switch_pg
 //#endif
                case PGRES_COPY_OUT:
                case PGRES_COPY_IN:
+               case PGRES_PIPELINE_SYNC:
+               case PGRES_PIPELINE_ABORTED:
                case PGRES_COMMAND_OK:
                        break;
                case PGRES_EMPTY_QUERY:

@ar45 and @andywolk you've recently made changes to mod_pgsql.c, is the above sufficient?

@ROBERT-MCDOWELL
Copy link
Contributor Author

@shaunjstokes
it seems to, as it's what I did and one month after no trouble occurs.
these 2 new status are maybe worth to explore to help FS to optimize its behavior with PG.

@shaunjstokes
Copy link
Contributor

@ROBERT-MCDOWELL I've just found your pull request https://github.com/signalwire/freeswitch/pull/1372, it's been pending for some time, @andywolk are you able to review?

@ROBERT-MCDOWELL
Copy link
Contributor Author

done

@shaunjstokes
Copy link
Contributor

Updated PR here: #1402

@ROBERT-MCDOWELL
Copy link
Contributor Author

@shaunjstokes
apparently it still does not compile
making all mod_pgsql
make[4]: Entering directory '/home/src/freeswitch/src/mod/databases/mod_pgsql'
CC mod_pgsql_la-mod_pgsql.lo
mod_pgsql.c: In function ‘pgsql_next_result_timed’:
mod_pgsql.c:758:17: error: enumeration value ‘PGRES_PIPELINE_SYNC’ not handled in switch [-Werror=switch]
758 | switch (res->status) {
| ^~~~~~
mod_pgsql.c:758:17: error: enumeration value ‘PGRES_PIPELINE_ABORTED’ not handled in switch [-Werror=switch]
cc1: all warnings being treated as errors
make[4]: *** [Makefile:727: mod_pgsql_la-mod_pgsql.lo] Error 1
make[4]: Leaving directory '/home/src/freeswitch/src/mod/databases/mod_pgsql'
make[3]: *** [Makefile:722: mod_pgsql-all] Error 1
make[3]: Leaving directory '/home/src/freeswitch/src/mod'
make[2]: *** [Makefile:623: all-recursive] Error 1
make[2]: Leaving directory '/home/src/freeswitch/src'
make[1]: *** [Makefile:3703: all-recursive] Error 1
make[1]: Leaving directory '/home/src/fr

@andywolk
Copy link
Contributor

andywolk commented Nov 1, 2021

@ROBERT-MCDOWELL try latest master

@ROBERT-MCDOWELL
Copy link
Contributor Author

I did it from the last master. I also clone a new repo but persists.

@ROBERT-MCDOWELL
Copy link
Contributor Author

Ok The problem come from POSTGRESQL_MAJOR_VERSION which is 14
but don't know why mod_pgsql.c does not accept it as 14 as value
if I comment it freeswitch compiles filne.

@ROBERT-MCDOWELL
Copy link
Contributor Author

problem solved, I sent the PR please approve it thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants