leafo / pgmoon

A pure Lua Postgres driver for use in OpenResty & more
MIT License
390 stars 93 forks source link

Creating a new postgres object causes a segmentation fault #106

Closed Elpersonn closed 3 years ago

Elpersonn commented 3 years ago

I am making a discord bot which is able to manage users via a DB connection. The bot runs on the luvit interpreter and also uses the discordia library. Every time I try to create the postgres object I get this message

# luvit test.lua
Segmentation fault (core dumped)

this is the code of test.lua


local discordia = require('discordia')
local pgmoon = require('pgmoon')
local bcrypt = require('bcrypt')
local client = discordia.Client()
local dbconn = pgmoon.new({ -- this object causes the segmentation fault
    host = "[redacted]",
    port = "5432",
    database = "[redacted",
    user = "[redacted]",
    password = "[REDACTED]"
})
client:on('ready', function ()
    --[[local ok, err = dbconn:connect()
    if not ok then
        error("COULD NOT CONNECT TO POSTGRES: "..err)
    end]]
    print('BOT RDY')
end)
client:on('messageCreate', function (message)
    print(message.channel.type)
    if message.channel.type == 1 and not message.author.bot then
        message:reply('hai')
    end
end)
client:run('[redacted]')
Elpersonn commented 3 years ago

its a luvit bug