Skip to content
This repository has been archived by the owner on Apr 9, 2024. It is now read-only.

PostgreSQL 14 support? #7

Open
penberg opened this issue Jun 20, 2023 · 5 comments
Open

PostgreSQL 14 support? #7

penberg opened this issue Jun 20, 2023 · 5 comments
Labels
enhancement New feature or request question Further information is requested

Comments

@penberg
Copy link
Collaborator

penberg commented Jun 20, 2023

We currently target PostgreSQL 15, but Fedora, for example, has PostgreSQL 14. Unfortunately due to PostgreSQL differences, the extension doesn't build:

zig build-lib pgturso Debug native: error: the following command failed with 2 compilation errors:
/home/penberg/src/turso/pgturso/zig/zig-linux-x86_64-0.11.0-dev.3724+32cb9462f/zig build-lib /home/penberg/src/turso/pgturso/src/main.zig -lc --cache-dir /home/penberg/src/turso/pgturso/zig-cache --global-cache-dir /home/penberg/.cache/zig --name pgturso -dynamic --version 0.1.0 -I /home/penberg/src/turso/pgturso/postgres/src/include --listen=-
Build Summary: 0/3 steps succeeded; 1 failed (disable with --summary none)
install transitive failure
└─ install pgturso transitive failure
   └─ zig build-lib pgturso Debug native 2 errors
src/main.zig:124:60: error: root struct of file '.home.penberg.src.turso.pgturso.zig-cache.o.6ed60b876cfd6a06a91994233d262fa0.cimport' has no member named 'String'
            const url_string = std.mem.span(@ptrCast([*c]pg.String, @alignCast(@import("std").meta.alignment([*c]pg.String), elem.*.arg)).*.sval);
                                                         ~~^~~~~~~
referenced by:
    _PG_output_plugin_init: src/main.zig:51:24
    remaining reference traces hidden; use '-freference-trace' to see all reference traces

/home/penberg/src/turso/pgturso/zig-cache/o/6ed60b876cfd6a06a91994233d262fa0/cimport.zig:12087:25: error: unable to translate C expr: expected ')' instead got '='
pub const fastgetattr = @compileError("unable to translate C expr: expected ')' instead got '='"); // /home/penberg/src/turso/pgturso/postgres/src/include/access/htup_details.h:711:9
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make: *** [Makefile:18: all] Error 2
@penberg penberg added the enhancement New feature or request label Jun 20, 2023
@penberg penberg changed the title PostgreSQL 14 support PostgreSQL 14 support? Jun 20, 2023
@penberg penberg added the question Further information is requested label Jun 20, 2023
@hirefrank
Copy link

I'm running into the same issue.

@hirefrank
Copy link

FWIW, I was able to build for Pg 15 with zig version 0.11.0-dev.3857+7322aa118 -- but can't get it to build for 14.

@psarna

@psarna
Copy link
Collaborator

psarna commented Sep 28, 2023

I wonder if this issue is platform-specific, with that specific zig 0.11 version as well. First thing, I'll try to make pg_turso work with zig 0.12 -- last time I tried, I hit a TODO implement readFromMemory for more types. Zigs are released daily, so it might have been fixed already, otherwise I'll dig further and try to fix the compiler issue. Once I have that, I'll try to figure out why postgres 14 headers get properly generated for me, and not on your arch/OS.

@psarna
Copy link
Collaborator

psarna commented Sep 28, 2023

Now I hit either ziglang/zig#17287 or similar:

zig build-lib pg_turso Debug native: error: the following command failed with 2 compilation errors:
/usr/lib/zig/zig build-lib -freference-trace=256 /home/sarna/repo/pgturso/src/main.zig -lc --cache-dir /home/sarna/repo/pgturso/zig-cache --global-cache-dir /home/sarna/.cache/zig --name pg_turso -dynamic --version 0.1.0 -I /home/sarna/repo/pgturso/postgres/src/include --listen=- 
Build Summary: 0/3 steps succeeded; 1 failed (disable with --summary none)
install transitive failure
└─ install pg_turso transitive failure
   └─ zig build-lib pg_turso Debug native 2 errors
/home/sarna/repo/pgturso/zig-cache/o/96c3fe63658d93a8238a5b8dd049db43/cimport.zig:4783:49: error: struct '.home.sarna.repo.pgturso.zig-cache.o.96c3fe63658d93a8238a5b8dd049db43.cimport.struct_OutputPluginCallbacks' depends on itself
pub const struct_OutputPluginCallbacks = extern struct {
                                         ~~~~~~~^~~~~~

@psarna
Copy link
Collaborator

psarna commented Sep 28, 2023

it's weird though, when I look at the generated zig code, the struct doesn't seem to depend on itself... maybe it's some indirect dependency

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants