jakob / jakob/Postico

Format SQL Statement fails when using pgFormatter config from Nix home-manager

Open
#851 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
485
Forks
8
PR merge metrics
No merged PRs in 30d

Description

What did you do?

I hit ⌃F to format a statement.

What did you expect to happen?

  • I expected my statement to be formatted.

What actually happened?

  • The app beeped at me, and nothing was formatted.

Suspected root cause

I'm using home-manager to manager my system, so ~/.pg_format is symlinked to /nix/store/844xrg862v21xh93dx0qxxvj71lhbmr3-home-manager-files/.pg_format.

If I remove the symlink and copy the file to ~/.pg_format, things work again. It even works if I rename the file, keep it in my homedir and symlink ~/.pg_format to that file.

This leads me to suspect that this is caused by sandboxing and that macOS sees that Postico is trying to access a file on a different volume. It's still a bit curious, though, because it fails even if I grant Postico full disk access.

What software versions are you using?

Postico version:
Version 2.0.4 (9636)

macOS version:
13.5.2 (22G91)

PostgreSQL version:
PostgreSQL 14.9 (Debian 14.9-1.pgdg120+1) on aarch64-unknown-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit

Postscript

Feel free to close this unless there is something interesting here. This is probably not a very common setup. :)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is identified in the issue. Start by reproducing SQL formatting with a symlinked ~/.pg_format on macOS, comparing it with a copied file; done means the statement formats successfully in the reported Postico and PostgreSQL setup.

Written by the indexing model from the issue text.

Assessment

Tech stack
macos, postgresql
Domain
databases, desktop, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.