Skip to content
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

SQL body in function failing with ParsePLPGLSQLToJSON() #129

Open
priyanshi-yb opened this issue Jan 14, 2025 · 0 comments
Open

SQL body in function failing with ParsePLPGLSQLToJSON() #129

priyanshi-yb opened this issue Jan 14, 2025 · 0 comments

Comments

@priyanshi-yb
Copy link

example -

CREATE OR REPLACE FUNCTION asterisks(n int)
  RETURNS text
  LANGUAGE sql IMMUTABLE STRICT PARALLEL SAFE
RETURN repeat('*', n);

and the panic while giving this query to ParsePLPGSQLToJSON()-

pg_query_parse_plpgsql.c:143: compile_create_function_stmt: Assertion `proc_source != ((void *)0)' failed.
SIGABRT: abort
PC=0x7f70265dc387 m=0 sigcode=18446744073709551610
signal arrived during cgo execution

goroutine 1 [syscall]:
runtime.cgocall(0x610150, 0xc0001f1d38)
        /usr/local/go/src/runtime/cgocall.go:157 +0x4b fp=0xc0001f1d10 sp=0xc0001f1cd8 pc=0x432dab
github.com/pganalyze/pg_query_go/v6/parser._Cfunc_pg_query_parse_plpgsql(0xfc89d0)
        _cgo_gotypes.go:415 +0x49 fp=0xc0001f1d38 sp=0xc0001f1d10 pc=0x53a689
github.com/pganalyze/pg_query_go/v6/parser.ParsePlPgSqlToJSON({0x7ce228?, 0x0?})
        /home/centos/go/pkg/mod/github.com/pganalyze/pg_query_go/[email protected]/parser/parser.go:146 +0x66 fp=0xc0001f1dc0 sp=0xc0001f1d38 pc=0x53ace6
github.com/pganalyze/pg_query_go/v6.ParsePlPgSqlToJSON(...)
        /home/centos/go/pkg/mod/github.com/pganalyze/pg_query_go/[email protected]/pg_query.go:52
main.main()
        /data/azure-test/main-parse.go:602 +0x2f fp=0xc0001f1f40 sp=0xc0001f1dc0 pc=0x60f84f
runtime.main()
        /usr/local/go/src/runtime/proc.go:267 +0x2bb fp=0xc0001f1fe0 sp=0xc0001f1f40 pc=0x464a3b
runtime.goexit()
        /usr/local/go/src/runtime/asm_amd64.s:1650 +0x1 fp=0xc0001f1fe8 sp=0xc0001f1fe0 pc=0x4903c1

goroutine 2 [force gc (idle)]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        /usr/local/go/src/runtime/proc.go:398 +0xce fp=0xc00005efa8 sp=0xc00005ef88 pc=0x464e8e
runtime.goparkunlock(...)
        /usr/local/go/src/runtime/proc.go:404
runtime.forcegchelper()
        /usr/local/go/src/runtime/proc.go:322 +0xb3 fp=0xc00005efe0 sp=0xc00005efa8 pc=0x464d13
runtime.goexit()
        /usr/local/go/src/runtime/asm_amd64.s:1650 +0x1 fp=0xc00005efe8 sp=0xc00005efe0 pc=0x4903c1
created by runtime.init.6 in goroutine 1
        /usr/local/go/src/runtime/proc.go:310 +0x1a

goroutine 3 [GC sweep wait]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        /usr/local/go/src/runtime/proc.go:398 +0xce fp=0xc00005f778 sp=0xc00005f758 pc=0x464e8e
runtime.goparkunlock(...)
        /usr/local/go/src/runtime/proc.go:404
runtime.bgsweep(0x0?)
        /usr/local/go/src/runtime/mgcsweep.go:280 +0x94 fp=0xc00005f7c8 sp=0xc00005f778 pc=0x451294
runtime.gcenable.func1()
        /usr/local/go/src/runtime/mgc.go:200 +0x25 fp=0xc00005f7e0 sp=0xc00005f7c8 pc=0x4463c5
runtime.goexit()
        /usr/local/go/src/runtime/asm_amd64.s:1650 +0x1 fp=0xc00005f7e8 sp=0xc00005f7e0 pc=0x4903c1
created by runtime.gcenable in goroutine 1
        /usr/local/go/src/runtime/mgc.go:200 +0x66

goroutine 4 [GC scavenge wait]:
runtime.gopark(0xc000088000?, 0x809498?, 0x1?, 0x0?, 0xc0000071e0?)
        /usr/local/go/src/runtime/proc.go:398 +0xce fp=0xc00005ff70 sp=0xc00005ff50 pc=0x464e8e
runtime.goparkunlock(...)
        /usr/local/go/src/runtime/proc.go:404
runtime.(*scavengerState).park(0xd8f6e0)
        /usr/local/go/src/runtime/mgcscavenge.go:425 +0x49 fp=0xc00005ffa0 sp=0xc00005ff70 pc=0x44eac9
runtime.bgscavenge(0x0?)
        /usr/local/go/src/runtime/mgcscavenge.go:653 +0x3c fp=0xc00005ffc8 sp=0xc00005ffa0 pc=0x44f05c
runtime.gcenable.func2()
        /usr/local/go/src/runtime/mgc.go:201 +0x25 fp=0xc00005ffe0 sp=0xc00005ffc8 pc=0x446365
runtime.goexit()
        /usr/local/go/src/runtime/asm_amd64.s:1650 +0x1 fp=0xc00005ffe8 sp=0xc00005ffe0 pc=0x4903c1
created by runtime.gcenable in goroutine 1
        /usr/local/go/src/runtime/mgc.go:201 +0xa5

goroutine 18 [finalizer wait]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        /usr/local/go/src/runtime/proc.go:398 +0xce fp=0xc00005a628 sp=0xc00005a608 pc=0x464e8e
runtime.runfinq()
        /usr/local/go/src/runtime/mfinal.go:193 +0x107 fp=0xc00005a7e0 sp=0xc00005a628 pc=0x445447
runtime.goexit()
        /usr/local/go/src/runtime/asm_amd64.s:1650 +0x1 fp=0xc00005a7e8 sp=0xc00005a7e0 pc=0x4903c1
created by runtime.createfing in goroutine 1
        /usr/local/go/src/runtime/mfinal.go:163 +0x3d

rax    0x0
rbx    0x7f7026daf000
rcx    0xffffffffffffffff
rdx    0x6
rdi    0x1745
rsi    0x1745
rbp    0x7f7026730f60
rsp    0x7fff878c5b68
r8     0x0
r9     0xfd4690
r10    0x8
r11    0x202
r12    0x84993e
r13    0x849ab0
r14    0xfce738
r15    0xc00022fa8f
rip    0x7f70265dc387
rflags 0x202
cs     0x33
fs     0x0
gs     0x0
exit status 2
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

No branches or pull requests

1 participant