我正在使用postgres,我有一个表的列,其数据类型是没有时区的时间戳.
我想将数据类型更改为bigint.我试图在列中存储自1970年以来的秒数.所以大有点像1397597908756.
我正在使用python,类似于:
d = dict() # create a dictionary, has key 'timestamp'
#get data from server and store in array
d.update(dict(timestamp=data[1]) #data[1] has the number of seconds
Run Code Online (Sandbox Code Playgroud)
我多次触摸服务器所以存储在字典中是必不可少的.查询是:
cursor.execute("INSERT into tablename columname VALUES (%s)", (quote['timestamp'];
Run Code Online (Sandbox Code Playgroud)
此时,抛出异常:
类型为timestamp的输入语法无效:1397597908756
所以我尝试将数据类型更改timestamp without timezone为bigint.我做了:
ALTER TABLE tablename ALTER COLUMN columnname
SET DATA TYPE bigint USING updated::bigint;
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
错误:无法将没有时区的类型时间戳转换为bigint
我在visual studio中调试c#代码,并且有变量如:
double?[] x;
string[] y;
Run Code Online (Sandbox Code Playgroud)
在当地人的窗口,我看到x的{double?[0]} 和y作为{string[0]}.那是什么意思?