]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_config_pgsql: Add text-type column check in require_pgsql() 25/head
authorBoris P. Korzun <drtr0jan@yandex.ru>
Fri, 18 Feb 2022 09:19:37 +0000 (12:19 +0300)
committerFriendly Automation <jenkins2@gerrit.asterisk.org>
Mon, 14 Mar 2022 14:10:33 +0000 (09:10 -0500)
Omit "unsupported column type 'text'" warning in logs while
using text-type column in the PgSQL backend.

ASTERISK-29924 #close

Change-Id: I48061a7d469426859670db07f1ed8af1eb814712

res/res_config_pgsql.c

index 81c165bfda155a88741039461b7b23e340a54d67..dbcd9e77b6507cb06d5c6becae466a7934e9b48e 100644 (file)
@@ -1234,8 +1234,8 @@ static int require_pgsql(const char *database, const char *tablename, va_list ap
                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;
                                        }