Skip to content

Commit

Permalink
Fixed dropping PostgreSQL materialized views.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
espinafre authored and nyalldawson committed May 11, 2020
1 parent d42e44f commit 13cf803
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/providers/postgres/qgspostgresdataitems.cpp
Expand Up @@ -59,7 +59,7 @@ bool QgsPostgresUtils::deleteLayer( const QString &uri, QString &errCause )
QString type = resViewCheck.PQgetvalue( 0, 0 );
if ( type == QLatin1String( "v" ) || type == QLatin1String( "m" ) )
{
QString sql = QString( "DROP VIEW %1" ).arg( schemaTableName );
QString sql = QString( "DROP %1VIEW %2" ).arg( type == QLatin1String( "m" ) ? "MATERIALIZED " : QString(), schemaTableName );
QgsPostgresResult result( conn->PQexec( sql ) );
if ( result.PQresultStatus() != PGRES_COMMAND_OK )
{
Expand Down

0 comments on commit 13cf803

Please sign in to comment.