[Asterisk-code-review] res_config_pgsql: Add text-type column check in require_pgsql() (asterisk[master])
Friendly Automation
asteriskteam at digium.com
Mon Mar 14 09:06:39 CDT 2022
Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/18081 )
Change subject: res_config_pgsql: Add text-type column check in require_pgsql()
......................................................................
res_config_pgsql: Add text-type column check in require_pgsql()
Omit "unsupported column type 'text'" warning in logs while
using text-type column in the PgSQL backend.
ASTERISK-29924 #close
Change-Id: I48061a7d469426859670db07f1ed8af1eb814712
---
M res/res_config_pgsql.c
1 file changed, 2 insertions(+), 2 deletions(-)
Approvals:
Joshua Colp: Looks good to me, but someone else must approve
Kevin Harwell: Looks good to me, but someone else must approve
Benjamin Keith Ford: Looks good to me, approved
Friendly Automation: Approved for Submit
diff --git a/res/res_config_pgsql.c b/res/res_config_pgsql.c
index 81c165b..dbcd9e7 100644
--- a/res/res_config_pgsql.c
+++ b/res/res_config_pgsql.c
@@ -1234,8 +1234,8 @@
AST_LIST_TRAVERSE(&table->columns, column, list) {
if (strcmp(column->name, elm) == 0) {
/* Char can hold anything, as long as it is large enough */
- if ((strncmp(column->type, "char", 4) == 0 || strncmp(column->type, "varchar", 7) == 0 || strcmp(column->type, "bpchar") == 0)) {
- if ((size > column->len) && column->len != -1) {
+ if ((strncmp(column->type, "char", 4) == 0 || strncmp(column->type, "varchar", 7) == 0 || strcmp(column->type, "bpchar") == 0 || strncmp(column->type, "text", 4) == 0)) {
+ if (column->len != -1 && (size > column->len)) {
ast_log(LOG_WARNING, "Column '%s' should be at least %d long, but is only %d long.\n", column->name, size, column->len);
res = -1;
}
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/18081
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I48061a7d469426859670db07f1ed8af1eb814712
Gerrit-Change-Number: 18081
Gerrit-PatchSet: 2
Gerrit-Owner: Boris P. Korzun <drtr0jan at yandex.ru>
Gerrit-Reviewer: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220314/5560ecf5/attachment.html>
More information about the asterisk-code-review
mailing list