Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ijOpF-0000Aq-Cj for pgsql-bugs@arkaria.postgresql.org; Mon, 23 Dec 2019 14:36:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ijOpE-00078F-2C for pgsql-bugs@arkaria.postgresql.org; Mon, 23 Dec 2019 14:36:48 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ijOpD-000788-N9 for pgsql-bugs@lists.postgresql.org; Mon, 23 Dec 2019 14:36:47 +0000 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ijOpA-0000Cz-Qh for pgsql-bugs@lists.postgresql.org; Mon, 23 Dec 2019 14:36:47 +0000 Received: by mail-pl1-x641.google.com with SMTP id f20so7272456plj.5 for ; Mon, 23 Dec 2019 06:36:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=xfBhKGmH8sIK+z7VuPRe8ZiUN0piCyQbWAHVjsBX8BA=; b=Hwb8GVksz6p36AD3LAsYLt6TKB6oK9GqyWNJsO8Y8wteBmYIzKVF8TXwoL2Vx1nhwJ 8Q3zL4vgJyPJBBz2HdsX6M9HeIaaKrhIr7Igncg5ONfr5r68HYf4Uv+Glx51mwcfb0UC tOyMd/yt6UEjg9lmPcvCB+SdHJPGTzzly8ruVRnkiffPyBPsxZmQu76QqnOziVK4ppgW /3QZDhghnZ+xDfXFfV58aSfb1U9pGmIa4gDxj9N1fCGZQsjtFskVhejDy/OEfboPbNGG 3pqp6SQItxUp0Viqs1JfIrO3pUEdDWecHT56lTNtYkQWzTeV5PX88LeN34jso0I67IOM uavg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=xfBhKGmH8sIK+z7VuPRe8ZiUN0piCyQbWAHVjsBX8BA=; b=j0MGLZcTMr/ozFLfBunpDrYtQmuK1fd0zFnZn3C3Zqp3wnIH4nyc3Ojda3AkLOn+nt NlqU/GBlnhuuNO/9ZzXCH2BRf/GS2tH0B5rD+7LouHZX/oFDGeHb7Sg64pqjs1l6bzH+ wOTrJkQj0vlWiQln1gnsOKPD3crVuI7jgpniFHaYbZWJpwX9JhLTN00LsLwMaI4pl1hi 4vD5SefrPNAhuFxsV2oD4MnX2+zJE9Derov3YSYJCHVXMU61KZW542bSC5MCcn9xc9Ko zpU9QVE4V8bqRPSEWSi/lhzABETKCtUFNl3h1H2SQxbcsmwIgueboYY/x42v9BMJvvwg 2Yrw== X-Gm-Message-State: APjAAAVT6QSWjV5YylJUK613mAtGw2kbj4j13rR/KN/UN6nUMn4xctna CKlgBgn/HSNRY2vHcWxeOfEMlw== X-Google-Smtp-Source: APXvYqy4NS7/ZvoWqGoAP72vvihSEdqhAFDvbHWHxwL2IqjUfUItYAu4w0rFYjiKcHGbDfijV4cycQ== X-Received: by 2002:a17:902:9b8e:: with SMTP id y14mr6883967plp.280.1577111802456; Mon, 23 Dec 2019 06:36:42 -0800 (PST) Received: from nimloth.alvh.no-ip.org ([190.121.29.3]) by smtp.gmail.com with ESMTPSA id o98sm21232904pjb.15.2019.12.23.06.36.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Dec 2019 06:36:41 -0800 (PST) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id D95B5300A83; Mon, 23 Dec 2019 11:36:38 -0300 (-03) Date: Mon, 23 Dec 2019 11:36:38 -0300 From: Alvaro Herrera To: andrei.pozolotin@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16177: pg_event_trigger_ddl_commands() returns empty set for ddl_command_start and "drop table" Message-ID: <20191223143638.GA16273@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <16177-053a34714817c3e1@postgresql.org> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2019-Dec-22, PG Bug reporting form wrote: > 1. use case is to delete rows with oid references to the table before "drop > table" I think you could achieve that with an event trigger on event sql_drop. IIRC that event trigger is run for the objects before the drops are actually executed. ddl_command_start is pretty useless, because it doesn't have much info abot the command being run; I'm sure that pg_event_trigger_ddl_commands() would always return empty there. The function would return non-empty only during ddl_command_end, but that's no useful to you because the drops will already have run. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services