ngx_postgres 模块使用方法location /postgres { internal; default_type text/html; set_by_lua_block $query_sql {return ngx.unescape_uri(ngx.var.arg_sql)} postgres_pass pg_server; rds_json on; rds_json_buffer_size 16k; postgres_query $query_sql; postgres_connect_timeout 1s; postgres_result_timeout 2s;
请看示例代码(注意 data 的数组下标):-- http://www.kyne.com.au/~mark/software/lua-cjson.php-- version: 2.1 devellocal json = require("cjson")local data = {1, 2}data[1000] = 99-- ... do the other thingsngx.say(json.encode(data))运行日志报错结果:2015/06/27 00:23:13 [error] 2714#0: *40 lua entry thread aborted: runtime error: ...