Skip to content

Commit 9bc7d4c

Browse files
espinafrenyalldawson
authored andcommittedMay 7, 2020
Fixed dropping PostgreSQL materialized views.
By default, the PostgreSQL provider allows the user to drop database objects from the Browser tree; however, the PostgreSQL syntax for dropping materialized views is different from dropping ordinary views. This fixes it, and adds the keyword "MATERIALIZED" accordingly. Fixes #36164
1 parent 3e2647e commit 9bc7d4c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎src/providers/postgres/qgspostgresdataitems.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ bool QgsPostgresUtils::deleteLayer( const QString &uri, QString &errCause )
5959
QString type = resViewCheck.PQgetvalue( 0, 0 );
6060
if ( type == QLatin1String( "v" ) || type == QLatin1String( "m" ) )
6161
{
62-
QString sql = QString( "DROP VIEW %1" ).arg( schemaTableName );
62+
QString sql = QString( "DROP %1VIEW %2" ).arg( type == QLatin1String( "m" ) ? "MATERIALIZED " : QString(), schemaTableName );
6363
QgsPostgresResult result( conn->PQexec( sql ) );
6464
if ( result.PQresultStatus() != PGRES_COMMAND_OK )
6565
{

0 commit comments

Comments
 (0)
Please sign in to comment.