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

Unknown type error in db plugin (pg) #1

Closed
spigell opened this issue Jan 15, 2019 · 2 comments
Closed

Unknown type error in db plugin (pg) #1

spigell opened this issue Jan 15, 2019 · 2 comments

Comments

@spigell
Copy link
Contributor

spigell commented Jan 15, 2019

Greetings!
Thank you for your libs.
If I make select query against type timestamp

query:
local result, err = pg:query("SELECT insert_date FROM table WHERE state = 0 LIMIT 1")

parse:
for _, r in pairs(result.rows) do
    for id, column in pairs(result.columns) do
        print(column, r[id])
    end
end
2019/01/15 18:25:11 [ERROR] unknown type (value: `time.Time{wall:0xfd2b478, ext:63683068860, loc:(*time.Location)(0xc0001d41e0)}`, converted: `time.Time{wall:0xfd2b478, ext:63683068860, loc:(*time.Location)(0xc0001d41e0)}`)


insert_date	nil

Is it possible to convent it to right type?
In typelist of Gopher-lua I did not found type time.
Thanks!

vadv added a commit that referenced this issue Jan 15, 2019
@vadv
Copy link
Owner

vadv commented Jan 15, 2019

thx! fixed in master.

now returns in lua unix timestamp (float64), you may convert returned value to date table with os.date("*t", r[id])

this link provides some inforamtion about time in lua: https://www.lua.org/pil/22.1.html

@spigell
Copy link
Contributor Author

spigell commented Jan 15, 2019

Thank you for fast reply.
It works now!

@spigell spigell closed this as completed Jan 15, 2019
scr-oath added a commit to scr-oath/gopher-lua-libs that referenced this issue Jul 21, 2022
* Added some structure to the sub-tests.

* Also must close a state to allow temp-file cleanup.

* add extra paren

Co-authored-by: Sheridan C Rawlins <scr@yahooinc.com>
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

2 participants