Re: Help Needed with Including External SQL Script in Extension Script - Mailing list pgsql-hackers

From David G. Johnston
Subject Re: Help Needed with Including External SQL Script in Extension Script
Date
Msg-id CAKFQuwZTs3ntzetDoGiRSLqTwS_1xDeqZB4TY7VrhQLJ22EuQg@mail.gmail.com
Whole thread Raw
In response to Help Needed with Including External SQL Script in Extension Script  (Ayush Vatsa <ayushvatsa1810@gmail.com>)
List pgsql-hackers
On Friday, July 26, 2024, Ayush Vatsa <ayushvatsa1810@gmail.com> wrote:

I wanted to modify the SQL script of an extension by creating multiple objects within it.
My aim is to make minimal changes to the existing script. To achieve this, I have created an
external script and am attempting to run it within the extension script using the \i command.

However, when I try to create the extension, I encounter the following error:
ERROR: syntax error at or near "\"

Could anyone advise on how I might resolve this issue? Alternatively, is there another way to create SQL objects outside of the main extension script, such that these objects are created when the extension script is executed?


Extension scripts are executed directly by the server as SQL, not via psql, so using psql features will not work.  In short, your extension script for a given version must be singular as the concept of “include files” is not understood by the execution environment.

David J.

pgsql-hackers by date:

Previous
From: Ayush Vatsa
Date:
Subject: Help Needed with Including External SQL Script in Extension Script
Next
From: Kirill Reshke
Date:
Subject: Re: Incremental View Maintenance, take 2