[英]is there any way to select all the fields data from the table except one field data using nodejs
I want to fetch all the fields data but don't want to specify the fields name and don't want to create a view.我想获取所有字段数据但不想指定字段名称并且不想创建视图。 I have tried我努力了
WITH orderschema as
(SELECT array_to_string(ARRAY(SELECT c.column_name
FROM information_schema.columns As c
WHERE table_name = 'orders'
AND c.column_name NOT IN('Quantity')
), ','))
SELECT * from orderschema
but this is returning the schema fields name as a single string and i can't use this single string to get all the fields from the orders table.但这会将架构字段名称作为单个字符串返回,我不能使用这个单个字符串从订单表中获取所有字段。 is there any way to exclude the field directly in psql?有没有办法直接在psql中排除该字段?
Generally speaking no such way exists.一般来说,这种方式是不存在的。
But - if you plan on converting data to JSON in Pg (which you shouldn't for performance reasons, but you might if you really, really want to), you could just delete the column from json.但是- 如果您计划在 Pg 中将数据转换为 JSON(出于性能原因,您不应该这样做,但如果您真的非常想这样做),您可以从 json.xml 中删除该列。
The best way, though, is to write query that lists only the columns you need.不过,最好的方法是编写只列出您需要的列的查询。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.