when i select data from pg10, some column does't display
forkforlearn opened this issue · 2 comments
forkforlearn commented
My table has three column
CREATE TABLE public.test_nextid
(
id serial,
name character varying(255),
desc character varying(255)
)
And i insert one recorder
inert into test_nextid (name) values("testname_1")
And i select all data from the table
local sql = "select * from test_nextid"
res,err = assert_error(db.query(sql))
--res,err = db.select("* from test_nextid")
But there is no desc in result....
I want to see the "desc " column in the result,what should i do? thank u
Leorex commented
"desc" is a reserved word in PostgreSQL, so you should name your column something else, like "dsc" or "description".
leafo commented
NULL
is converted to nil
in Lua, and nil
values don't exist in a table so they aren't in there.
https://github.com/leafo/pgmoon#converting-nulls
@Leorex that is not an issue, and you can use escape_identifier
to use any string as a column name