- 🇹🇷Turkey orkut murat yılmaz Istanbul
Hello all,
The error log still exists, as I'm pasting below:
Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error at or near "DESCRIBE" LINE 1: DESCRIBE mytable ^: DESCRIBE mytable; Array ( ) in Drupal\view_custom_table\Form\AddViewsCustomTable->buildForm() (line 202 of /var/www/html/tcv2/web/modules/contrib/view_custom_table/src/Form/AddViewsCustomTable.php).
I think that the error's cause is the
DESCRIBE
command, which belongs to MySQL and not valid in PostgreSQL.We should override the error by using PostgreSQL commands.
Best,
Orkut - Status changed to Active
over 1 year ago 8:26am 12 April 2023 - 🇹🇷Turkey orkut murat yılmaz Istanbul
Maybe we should modify the code for postgres like this:
$connection = Database::getConnection('default', $databaseName); $schema = $connection->escapeString($schemaName); $table = $connection->escapeString($tableName); $text_query = "SELECT column_name, data_type FROM information_schema.columns WHERE table_schema = '$schema' AND table_name = '$table'"; $query = $connection->query($text_query);
- 🇨🇦Canada joseph.olstad
@Orkut Murat Yilmaz, have you tested #6 with Postgres ? does that fix the issue?
I wonder if that would work with mysql also?
- 🇹🇷Turkey orkut murat yılmaz Istanbul
@joseph.olstad, thanks for your comments.
I've tried adding a custom table with this module's 2.0.4 and 2.0.x-dev versions too, bug is still there in the recent log messages.
The query on #6 works with PostgreSQL, but I am not sure it would work for both databases as well.
Maybe we can add a control before adding it, in order to check which database is connected. Does it sound okay?