diff --git a/cdr/cdr_pgsql.c b/cdr/cdr_pgsql.c
index 0bdb19f03db030ff5fc814e161cce273c02d8f56..ef47bb77935045054f09443ebe4dec2ed43d4c4e 100644
--- a/cdr/cdr_pgsql.c
+++ b/cdr/cdr_pgsql.c
@@ -455,7 +455,7 @@ static int config_module(int reload)
 
 	conn = PQsetdbLogin(pghostname, pgdbport, NULL, NULL, pgdbname, pgdbuser, pgpassword);
 	if (PQstatus(conn) != CONNECTION_BAD) {
-		char sqlcmd[256];
+		char sqlcmd[512];
 		char *fname, *ftype, *flen, *fnotnull, *fdef;
 		int i, rows;
 		ast_debug(1, "Successfully connected to PostgreSQL database.\n");