Coder Social home page Coder Social logo

Comments (2)

cbandy avatar cbandy commented on September 15, 2024

Is this true? Can you please show an example of the quotes having an effect?

from pgaudit.

rdunklau avatar rdunklau commented on September 15, 2024

Not on pgaudit itself, as mentioned it doesn't matter in practice here, but it gives a false sense of doing the right thing.

See this example:

create schema if not exists "public, pg_catalog, pg_temp";

create or replace function public.f1() returns timestamptz as $$
SELECT now();
$$ language sql;

create or replace function "public, pg_catalog, pg_temp".f1() returns timestamptz as $$
BEGIN
    RETURN '1900-01-01'::timestamptz;
END
$$ language plpgsql;

create or replace function test_function() returns timestamptz AS $$
    SELECT f1();
$$ language sql;

create or replace function test_function2() returns timestamptz AS $$
    SELECT f1();
$$ language sql
SET search_path = public, pg_catalog, pg_temp;

create or replace function test_function3() returns timestamptz AS $$
    SELECT f1();
$$ language sql
SET search_path = 'public, pg_catalog, pg_temp';

Now running that:

ro=# SELECT 
test_function() as default_search_path, 
test_function2() as correct_search_path, 
test_function3() as quoted_search_path;
     default_search_path      |     correct_search_path      |      quoted_search_path      
------------------------------+------------------------------+------------------------------
 2023-10-27 08:24:40.94749+02 | 2023-10-27 08:24:40.94749+02 | 1900-01-01 00:00:00+00:09:21
(1 ligne)

from pgaudit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.