Repository navigation
Allow ON MASTER for external file protocol - #262
Merged
Merged
Conversation
reshke
approved these changes
Sep 9, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 '"');