Re: extension_control_path and "directory" - Mailing list pgsql-hackers

From David E. Wheeler
Subject Re: extension_control_path and "directory"
Date
Msg-id E36A12DF-B8F7-4D48-AAD2-90A8A1220BA5@justatheory.com
Whole thread Raw
In response to Re: extension_control_path and "directory"  (Matheus Alcantara <matheusssilv97@gmail.com>)
Responses Re: extension_control_path and "directory"
List pgsql-hackers
On Apr 29, 2025, at 09:49, Matheus Alcantara <matheusssilv97@gmail.com> wrote:

> Yes, it is a single path from the search path, in your case it will be
> "/Users/david/Downloads/share/postgresql" and "$system". We split these
> paths based on the system path separator and get the next "piece" here:
>
>            char       *piece = first_path_var_separator(ecp);
>
> The first_path_var_separator() changes the "ecp" parameter on every call,
> it returns the next path on "ecp" and changes it to have the remaining
> paths to iterate over it.

Right. My point is a minor one, but I thin you can use an if/ else there:

```c
if (strcmp(piece, "$system") == 0) {
    /* Substitute the path macro if needed */
    mangled = substitute_path_macro(piece, "$system", system_dir);
} else {
    /*
    * Append "extension" suffix in case is a custom extension
    * control path.
    */
    mangled = psprintf("%s/extension", mangled);
}
```

Best,

David


Attachment

pgsql-hackers by date:

Previous
From: "David E. Wheeler"
Date:
Subject: Re: RFC: Additional Directory for Extensions
Next
From: Robert Haas
Date:
Subject: Re: ZStandard (with dictionaries) compression support for TOAST compression