Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jbKM1-000367-Vz for pgsql-hackers@arkaria.postgresql.org; Wed, 20 May 2020 08:45:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jbKM0-0004KL-Qx for pgsql-hackers@arkaria.postgresql.org; Wed, 20 May 2020 08:45:32 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jbKM0-0004KE-Js for pgsql-hackers@lists.postgresql.org; Wed, 20 May 2020 08:45:32 +0000 Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jbKLx-0001wx-RL for pgsql-hackers@lists.postgresql.org; Wed, 20 May 2020 08:45:31 +0000 Received: by mail-ej1-x62c.google.com with SMTP id a2so2579131ejb.10 for ; Wed, 20 May 2020 01:45:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:date:in-reply-to:references:user-agent :mime-version:content-transfer-encoding; bh=4VK61CpJ+6HNyTNT3gmDmDyNb8Gb9wo57o+F6T+i0S4=; b=iCqDqucpHysD9M4qxtgXS4EbJj0gj3fqbZwReaKMFKhPEa2s8DAZSw75xc0vwnxpTC GDM40cX3+hRCNNoeBDvwP20IkaDbbvkzyPrVx0NHQEon4TlHtP2asXXp0DasP6rKwVFd coXqVNi/u40SOgarpmMksAij62u7sJk8CdzObOLZUktCPEZy/0gfa+dhZ7RiRMd7wfUh WIJynZUIWxXJS2tVzmECBdE+OzXAIMTLQbuWsP3bS5HqoFXJOl5jq96LBn4gjqFfie2o QqNW2qZ32D5TjEkuN1+WeKLtGrBkNKY2JR+za++5muDYBYffbrWUpAGfHR8xUmiG8F98 UJFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=4VK61CpJ+6HNyTNT3gmDmDyNb8Gb9wo57o+F6T+i0S4=; b=N34G6U8EX46hi0tdQmK1Cf7M1yjBKaO6HkAK3lR1Jb4Yy3Fqe9osvy6gL1ANEOQZQ3 +VFTw5ThWD2qH8urQLo/8q9KzAqgWpm98WH49j9RUPYoHq0rFGOovfXQflBjzHOGhmVT R8jWvg1+bagSi+UtCr065p/1DDFG9RbH1yreUM5SgzmmO64MlbUbyNKzeW7ZyUlKV7jD XDmm5Ns5whznC6dtS2e4FwS6s0Z5DKjL4uh0qhbZKNZ0zQ9vEmOCGxl+YNeJX2bLbeWj DVNImFAewmGeHnbKKj8U1Yl7CrzOAiPgr2Ok8cEB60TS224CvOO9FifGrxRgVwG6pfH8 MKLQ== X-Gm-Message-State: AOAM532kii+J3jGUSuJCc90ocA0tHIirtivWREJ2EXViD8UcgII+MHda 8yXaRM/+Y0/qryf2M5Fccxa2ag== X-Google-Smtp-Source: ABdhPJzMWsfaNg6dmaKQKqsZeEfyra2eYo4TT2j+sttq52xhOm4gR/7qB1V0tiEAmuAcXhI3gIFz/w== X-Received: by 2002:a17:906:b5c1:: with SMTP id ep1mr2664395ejb.528.1589964327809; Wed, 20 May 2020 01:45:27 -0700 (PDT) Received: from dynamic-eotlmt57cxwt1wzm9-pd01.res.v6.highway.a1.net (dynamic-eotlmt57cxwt1wzm9-pd01.res.v6.highway.a1.net. [2001:871:60:b467:23a6:b9e0:a2d5:f151]) by smtp.gmail.com with ESMTPSA id g20sm1240492edp.31.2020.05.20.01.45.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 May 2020 01:45:27 -0700 (PDT) Message-ID: Subject: Re: Extensions not dumped when --schema is used From: Laurenz Albe To: Guillaume Lelarge , PostgreSQL Hackers Date: Wed, 20 May 2020 10:45:26 +0200 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.32.5 (3.32.5-1.fc30) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Wed, 2020-05-20 at 10:06 +0200, Guillaume Lelarge wrote: > I've discovered something today that I didn't really expect. > When a user dumps a database with the --schema flag of pg_dump, > extensions in this schema aren't dumped. As far as I can tell, > the documentation isn't clear about this ("Dump only schemas > matching pattern; this selects both the schema itself, and all > its contained objects."), though the source code definitely is > ("We dump all user-added extensions by default, or none of them > if include_everything is false (i.e., a --schema or --table > switch was given).", in pg_dump.c). > > I was wondering the reason behind this choice. If anyone knows, > I'd be happy to hear about it. > > I see two things: > * it's been overlooked, and we should dump all the extensions > available in a schema if this schema has been selected through > the --schema flag. > * it's kind of like the large objects handling, and I'd pretty > interested in adding a --extensions (as the same way there is a > --blobs flag). I am not sure if there is a good reason for the current behavior, but I'd favor the second solution. I think as extensions as belonging to the database rather than the schema; the schema is just where the objects are housed. Yours, Laurenz Albe