PostgreSQL Database Interface
3 Attachment(s)
This driver is now included in SourceMod starting with version 1.11.0.6666.
This extension provides PostgreSQL database support to SourceMod. There is a bug report open for this, but i don't use pgsql so i can't test it in a production environment. Putting it up here to see if someone got a use for it and confirms it does what you expect. The extension is currently compiled against postgresql 9.3.2. It registers a "pgsql" database driver. To use this, just set the "driver" key in the databases.cfg section to "pgsql" like this: Code:
"pgtest" 1. Drag & Drop Due to syntax differences in the SQL flavours between MySQL, sqlite and PostgreSQL you can't be sure that all plugins will run out of the box with pgsql. You might need to slightly alter your queries depending on the used database driver. Just like you already have to do with different sql syntax between mysql and sqlite! Latest builds against SM 1.10 and PostgreSQL 9.6.9 HERE. This extension is compiled against SourceMod 1.6 and won't run on SM 1.5. This is due to some refactoring of the DBI system in 1.6 and me being too lazy to backport the extension to 1.5! |
Re: PostgreSQL Database Interface
Sorry if this is a newb question but what is the big difference between MySql and PostgreSQL
Also do they use the same sql queries, format etc? |
Re: PostgreSQL Database Interface
Quote:
http://www.wikivs.com/wiki/MySQL_vs_PostgreSQL https://www.scriptrock.com/articles/postgres-vs-mysql/ https://www.udemy.com/blog/mysql-vs-postgresql/ |
Re: PostgreSQL Database Interface
Quote:
|
Re: PostgreSQL Database Interface
Can i recompile with 9.4 driver easily?
|
Re: PostgreSQL Database Interface
(This is a repost from a PM I sent, in case anyone else has this issue)
Hello Peace-Maker, I was wondering about the current state of the PostgreSQL driver for sourcemod. When I do threaded queries against it, the server crashes and gives me this error. Quote:
Thank you for your time, printf P.S. I forgot to mention that I also rebased it on 1.7-dev. The patches applied okay, and I didn't think there would be problems. (Since there's not much recent commit history to the MySQL driver) EDIT2: It also happens when I rebase to 1.6-dev. |
Re: PostgreSQL Database Interface
2 Attachment(s)
This is compiled against PostgreSQL 9.6.0. Give it a try and see if it still crashes! It's compiled against SM master so requires SM 1.8+.
https://github.com/alliedmodders/sourcemod/pull/32 |
Re: PostgreSQL Database Interface
Quote:
Code:
(gdb) bt |
Re: PostgreSQL Database Interface
I can't frequently fail to upload files to the forum. Try this one.
|
Re: PostgreSQL Database Interface
Quote:
I've converted all of my queries to work in PostgreSQL, but I still get odd things like this in parsing: Code:
row number 135 is out of range 0..134 |
Re: PostgreSQL Database Interface
Looks like another bug. I've updated the package for that. Patches getting added to the PR.
Keep the reports coming :) |
Re: PostgreSQL Database Interface
Can you please add port to database.cfg, because i want to use my custom port not 5432
|
Re: PostgreSQL Database Interface
Quote:
|
Re: PostgreSQL Database Interface
Quote:
Anyway i made a default port 5432 and it still give me this error, don't know what to do, i have PostgreSQL-9.4 on server and PostgreSQL-9.2 on client and i configured it to connect to the server but the extension still give me this error, don't know why. L 06/11/2017 - 23:03:21: [SM] Exception reported: OnDBConnect could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"? |
Re: PostgreSQL Database Interface
Quote:
That error message is straight from the Postgres client library, if you search for "Is the server running locally and accepting connections on Unix domain socket" you'll see many people discussing it and hopefully be able to solve it. |
Re: PostgreSQL Database Interface
Quote:
|
Re: PostgreSQL Database Interface
Paste your databases.cfg section which is causing trouble please (without credentials).
|
Re: PostgreSQL Database Interface
Quote:
{ "driver" "pgsql" "host" "178.170....." "database" "testvip" "user" "postgres" "pass" "password" "port" "5432" "timeout" "40 } |
Re: PostgreSQL Database Interface
Your "timeout" line is missing a quote at the end.
|
Re: PostgreSQL Database Interface
It's not the problem, this error exists even if i delete the port and timeout
|
Re: PostgreSQL Database Interface
How did you fix the error on your command line client?
It sounds like you didn't set a "host" IP and it's falling back to the local socket. You're using the build linked in post 11 right? |
Re: PostgreSQL Database Interface
I fixed it by making this:
1- I changed listen_addresses = 'localhost' in postgresql.conf to listen_addresses = '*' 2- In pg_hba.conf i have added a new line "host all all 178.170..../32 password" Then service postgresql restart And that fixed the problem on client side, but the extension won't work |
Re: PostgreSQL Database Interface
I have pgsql server 9.4 version working on Debian 8, yes and i was using the extension in 11 post, but when i saw that it's not working i tried the first one, but still give me this error.
About host ip i set it to my webserver, but it's still work like localhost, don't know why |
Re: PostgreSQL Database Interface
If you need any logs, please tell me i will give you
|
Re: PostgreSQL Database Interface
So no one knows how to fix this? Still the same error and i did not find any solution
|
Re: PostgreSQL Database Interface
Quote:
L 06/17/2017 - 21:04:48: [SM] Exception reported: OnDBConnect password='MyDatabasePassHere' could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"? Its a bug, the buffer is zero, and he added just the pass because he is at the end, so he goes to localhost, and thats not a normal bug :D, fix it please, and me will try to find something else to make it work. |
Re: PostgreSQL Database Interface
Quote:
|
Re: PostgreSQL Database Interface
Quote:
snprintf sets NULL at the end and i thing on copy the buffer sets it to zero data. I am now working with sprintf(buffer,"%s",data) |
Re: PostgreSQL Database Interface
Hello again, i have another error its go after i think create tables, the error is:
sourcemod/public/amtl/amtl/am-thread- utils.h:140: void ke::Lockable::Lock(): Assertion `Owner() != GetCurrentThreadId ()' failed. How i can fix it? |
Re: PostgreSQL Database Interface
Quote:
Thank you for narrowing it down to the option buffers! snprintf (obviously) behaves differently on windows and linux. |
Re: PostgreSQL Database Interface
Quote:
|
Re: PostgreSQL Database Interface
Quote:
|
Re: PostgreSQL Database Interface
Quote:
|
Re: PostgreSQL Database Interface
Quote:
Then "run" at the GDB prompt when all loaded. You must use srcds_linux instead of the srcds_run wrapper. |
Quote:
Code:
(gdb) bt I think this place cause the error on 366 Ok, i know now that it was the error here, in plugin this code was causing driver crash Quote:
And here another error, when i enter the game and the server is loading, on load game files at csgo server, in the client i mean, it stops at that loading and nothing happen, but when i started to debug it, i found this: Quote:
And here is the code of that place at 742 line: http://i.imgur.com/GTdxsVr.png |
Re: PostgreSQL Database Interface
Aaaand i had some fun finding this bug, and here what i have got, first take tha backtrace with variables:
Quote:
Quote:
in PgDatabase.cpp Quote:
|
Re: PostgreSQL Database Interface
2 Attachment(s)
Quote:
Attached are the latest builds from the PR compiled against PostgreSQL 9.6.9. |
Re: PostgreSQL Database Interface
When specifying host, user and password in databases.cfg, it is trying to connect to unix socket in /tmp/.s.PGSQL.5432.
|
Re: PostgreSQL Database Interface
Are you setting the host to "localhost"? Try "127.0.0.1" instead, so it uses the IP stack instead of local sockets. You can just set it to the correct path to the sock file too.
|
Re: PostgreSQL Database Interface
Quote:
Quote:
|
All times are GMT -4. The time now is 15:31. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.