Skip to content
Permalink
Browse files

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
  • Loading branch information
espinafre authored and nyalldawson committed May 6, 2020
1 parent 3e2647e commit 9bc7d4c90cf3072b7f7ab3683cb4cdde8c9ddf5c
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/providers/postgres/qgspostgresdataitems.cpp
@@ -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 )
{

0 comments on commit 9bc7d4c

Please sign in to comment.
You can’t perform that action at this time.