[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua and Postgres
- From: Steve Litt <slitt@...>
- Date: Sat, 15 Jan 2011 16:32:34 -0500
On Saturday 15 January 2011 15:53:26 Ed wrote:
> my fork of luapgsql:
> https://github.com/edo1/luapgsql
>
> db:exec('LISTEN somenotify')
> -- wait indefinitely for NOTIFY:
> db:notifywait()
> -- OR wait for NOTIFY, up to six seconds
> db:notifywait(6)
>
> for my needs NOTIFY-wait function is better, but if someone need
> NOTIFY-driven callback - it can be added as well.
Hi Ed,
I'm not even to the point where I can choose between db:exec() or the higher
level stuff. Look what happens to me with this little program:
#!/usr/bin/lua
require "luasql.postgres"
envv = assert (luasql.postgres())
con = assert (envv:connect("testlua", "slitt", nil))
The preceding program produces the following output:
slitt@mydesk:~$ ./littfails.lua
/usr/bin/lua: ./littfails.lua:4: LuaSQL: Error connecting to database.
stack traceback:
[C]: in function 'assert'
./littfails.lua:4: in main chunk
[C]: ?
slitt@mydesk:~$
Suspecting the database, I went into psql and did a \l command, which produced
the following:
List of databases
Name | Owner | Encoding | Access privileges
-----------+----------+----------+-----------------------
junkdb | slitt | UTF8 |
mydb | postgres | UTF8 |
postgres | postgres | UTF8 |
template0 | postgres | UTF8 | =c/postgres
postgres=CTc/postgres
template1 | postgres | UTF8 | =c/postgres
postgres=CTc/postgres
testlua | slitt | UTF8 |
(6 rows)
Note that for inclusion in email I removed the Collation and Ctype columns,
but all the databases were Collation en_US.UTF-8 and Ctype en_US.UTF-8
Anyway, database testlua was one I had just created within psql and I didn't
give it a password. So I'm confused why LuaSQL.postgres's connect() command
fails. I spent a couple hours putting in various combinations of stuff as its
arguments, did a bunch of googling, and absolutely nothing changed the
symptom. I'm beginning to think there's a basic fact that I'm missing.
Thanks
SteveT
Steve Litt
Recession Relief Package
http://www.recession-relief.US
Twitter: http://www.twitter.com/stevelitt