Skip to content

chore: create an isolated output for postgres, to expose debug symbols #1200

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 12, 2024

Conversation

samrose
Copy link
Collaborator

@samrose samrose commented Sep 12, 2024

This is a small PR to expose only the underlying postgresql_15 package. It turns out that postgresql in nixpkgs are already built with debug symbols enabled, but in a separate directory which is considered the best practice.

To access these symbols you can run

nix build .#postgresql_15.debug && nix derivation show .#postgresql_15.debug | jq -r '.[].env.debug'
/nix/store/pxx1mdvxdq932km87a8d8q4nqvadpspy-postgresql-15.6-debug

Then use /nix/store/<yourpath>-postgresql-15.6-debug in your debugger and these will be the corresponding debug symbols for the current version of postgresql_15

this same method will work going forward with our own packaging of postgresql as well.

@samrose samrose requested a review from a team as a code owner September 12, 2024 15:22
@samrose samrose requested a review from pashkinelfe September 12, 2024 15:23
to give access to the source of the postgresql_15 package we use
@steve-chavez
Copy link
Member

With this is also possible to do nix build .#postgresql_15_src, and then get the source code:

ls -la result
lrwxrwxrwx 1 user user 66 Sep 12 16:43 result -> /nix/store/bgf6a5l4hpsf19c3h4jfx2vykxmysy58-postgresql-15-src-15.6

ls /nix/store/bgf6a5l4hpsf19c3h4jfx2vykxmysy58-postgresql-15-src-15.6/src/
/nix/store/bgf6a5l4hpsf19c3h4jfx2vykxmysy58-postgresql-15-src-15.6/src/:
backend  common      fe_utils  interfaces  Makefile.global.in  Makefile.shlib  pl    template  timezone  tutorial
bin      DEVELOPERS  include   Makefile    makefiles           nls-global.mk   port  test      tools

I haven't tried it with GDB yet, but it's a start.

@samrose samrose merged commit f255d5b into develop Sep 12, 2024
8 checks passed
@samrose samrose deleted the sam/postgres-debug branch September 12, 2024 21:50
damonrand pushed a commit to cepro/postgres that referenced this pull request Jun 15, 2025
supabase#1200)

* chore: create an isolated output for just postgres, to expose debug symbols

* feat: add an optional package for local dev that can be built
to give access to the source of the postgresql_15 package we use

---------

Co-authored-by: Sam Rose <samuel@supabase.io>
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.

4 participants