Skip to content

Allow ON MASTER for external file protocol - #262

Merged
Smyatkin-Maxim merged 2 commits into
OPENGPDB_STABLEfrom
max/ext_on_master
Sep 9, 2025
Merged

Smyatkin-Maxim merged 2 commits into
OPENGPDB_STABLEfrom
max/ext_on_master

Conversation

@Smyatkin-Maxim

@Smyatkin-Maxim Smyatkin-Maxim commented Sep 8, 2025 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Allows LOCATION ... ON MASTER syntax for file:// protocol in external tables.

Additional Context

The syntax was already there but it is not supported for any ext table protocols except CUSTOM. I've added support for local files. My motivation is use this mechanism as yet another way to read logs from the local filesystem. It's already possible with EXECUTE in external web tables, but for security reasons we prohibit it completely in our installations.
Something like this:

CREATE READABLE EXTERNAL TABLE pg_log_tbl_master 
(                                    
    logtime timestamp with time zone,
    loguser text,
    logdatabase text,
    logpid text,
    logthread text,
    loghost text,
    logport text,                           
    logsessiontime timestamp with time zone,
    logtransaction int,
    logsession text,
    logcmdcount text,
    logsegment text,
    logslice text,
    logdistxact text,
    loglocalxact text,
    logsubxact text,
    logseverity text,
    logstate text,
    logmessage text,
    logdetail text,
    loghint text,
    logquery text,
    logquerypos int,
    logcontext text,
    logdebug text,
    logcursorpos int,
    logfunction text,
    logfile text,
    logline int,
    logstack text
)                                                                      
LOCATION (
    'file://my_local_cloudberry_build/gpAux/gpdemo/datadirs/dbfast1/demoDataDir0/pg_log/*.csv' 
) ON MASTER
FORMAT 'CSV' (DELIMITER AS ',' NULL AS '' QUOTE AS '"');

@Smyatkin-Maxim
Smyatkin-Maxim merged commit 3160317 into OPENGPDB_STABLE Sep 9, 2025
17 checks passed
@reshke
reshke deleted the max/ext_on_master branch November 5, 2025 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants