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 1mZZUp-0002zB-EC for pgsql-admin@arkaria.postgresql.org; Sun, 10 Oct 2021 14:08:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mZZUo-0000cR-DH for pgsql-admin@arkaria.postgresql.org; Sun, 10 Oct 2021 14:08:10 +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 1mZZUo-0000cG-2Q for pgsql-admin@lists.postgresql.org; Sun, 10 Oct 2021 14:08:10 +0000 Received: from mail-qk1-x72c.google.com ([2607:f8b0:4864:20::72c]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mZZUk-0005AS-QL for pgsql-admin@lists.postgresql.org; Sun, 10 Oct 2021 14:08:09 +0000 Received: by mail-qk1-x72c.google.com with SMTP id ay35so5466629qkb.10 for ; Sun, 10 Oct 2021 07:08:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :references:from:in-reply-to; bh=/EwCoS32D9Y+koE8r28uNu6DS7Z2XAOzY6aWrDZcAJM=; b=bR7F3nCLOE4PML6Dfdd97JTMA6onvjxavzTE3K+mUKsKE035qJtsJYxXFsv2/+lVuF 95ORvTe28ADtwnloj7nlIKZvV3LBb5GMB48fs7b0q3utFEVtOdeXzKrstN8ltSC5YxMG nqnf5hk8FRrzA7lfhwoqpxHsZDx9f+N9zm3nVBXTdEKMyDJRgvMyXaIeQ6bLolkzLS42 rKgp3iT2q0rBI7rqDzW0mO0f+sT/7571DSmooqzvHTuMAzpGjdIUMekfu6IGpHekldMt FUwNHHFUs4sxH1Az2m2TKxX0U00JhCimdpUmycefjun6uprhMVb0A2l+jVPTiiIBtQ9J 9Rgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to; bh=/EwCoS32D9Y+koE8r28uNu6DS7Z2XAOzY6aWrDZcAJM=; b=yyi6NiqRwHwBe10mufn/kVyOeTnIJU0R3i4RhvxNMWMz50Q2bN+XyLm98+cpYyD3s2 ddVJtnWpmvuUgiyV2YH9BJJnXKNMDJ1Vko2Or/LHFYl0kFeMbODJQVDQQX8c0hGdzLIG 7fCoB1cQViUmykjUPabYofrw3XPB6E+lS/KDW3K7lQj6JqoLNrL7WEjWHlc2KnJtJPrJ Gde2LWPj8FCS4wpTXe8N42998pbqCxHqTv7DheWY4PgA4S+etregTdogSq82PIhV6Qj0 RWmxyn+UDgjGvBkDmXAvdTNh+tbAW8K6mjggfMtfjjIdRDjsNkm10lmWE0FqwDc9Cgp/ h0FQ== X-Gm-Message-State: AOAM532mIX3ThDo+fkvSSsr3BsWej5KfUMYe9Ab5v3EJGKJLxX0am36K HjsOld0sKMkJNkVKUIA1nz05L316aB+E6A== X-Google-Smtp-Source: ABdhPJxRGgpP/RYyBNZfS4FAy55kN96zJQ2O677HOgl7teTfcyvsif6Ukk1JYVBXm8BczE9FovH7Hw== X-Received: by 2002:a37:b242:: with SMTP id b63mr10985340qkf.346.1633874883961; Sun, 10 Oct 2021 07:08:03 -0700 (PDT) Received: from [192.168.2.100] (pool-72-79-19-93.nwrknj.east.verizon.net. [72.79.19.93]) by smtp.gmail.com with ESMTPSA id t190sm1130966qkb.1.2021.10.10.07.08.03 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 10 Oct 2021 07:08:03 -0700 (PDT) Content-Type: multipart/alternative; boundary="------------Qs8ueBqs81UHV0rX6mFdhmHf" Message-ID: <77700cbc-99da-c231-1234-b207494b49a9@gmail.com> Date: Sun, 10 Oct 2021 10:08:02 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.0 Subject: Re: Hide function source Content-Language: en-US To: pgsql-admin@lists.postgresql.org References: <1331401808.1491628.1633855833151.ref@mail.yahoo.com> <1331401808.1491628.1633855833151@mail.yahoo.com> From: Mladen Gogala In-Reply-To: <1331401808.1491628.1633855833151@mail.yahoo.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------Qs8ueBqs81UHV0rX6mFdhmHf Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 10/10/21 04:50, Nelson Gonzaga wrote: > Dear, > How do I hide a function source code from all users except superuser, > but all can execute it? > Thanks, > Nelson That is not possible. Postgres doesn't store functions in the compiled form, it stores them in the source form. Each process that executes a function has to compile it first. If you are looking for something like the Oracle "wrap", it might exist as an extension, I don't know. Please be aware that even Oracle "wrap" is not very secure. There is a public SQL*Developer extension which unwraps the wrapped source code. -- Mladen Gogala Database Consultant Tel: (347) 321-1217 https://dbwhisperer.wordpress.com --------------Qs8ueBqs81UHV0rX6mFdhmHf Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit


On 10/10/21 04:50, Nelson Gonzaga wrote:
Dear,
How do I hide a function source code from all users except superuser, but all can execute it?
Thanks,
Nelson

That is not possible. Postgres doesn't store functions in the compiled form, it stores them in the source form. Each process that executes a function has to compile it first. If you are looking for something like the Oracle "wrap", it might exist as an extension, I don't know. Please be aware that even Oracle "wrap" is not very secure. There is a public SQL*Developer extension which unwraps the wrapped source code.

-- 
Mladen Gogala
Database Consultant
Tel: (347) 321-1217
https://dbwhisperer.wordpress.com
--------------Qs8ueBqs81UHV0rX6mFdhmHf--