CONCAT函数在Postgres 10中不起作用

时间:2018-09-07 09:42:31

标签: postgresql

select CONCAT(name, desc) from table; 

给出以下错误

 ERROR:  syntax error at or near "desc"
 LINE 1: select CONCAT(name, desc) from theme;
                            ^
 SQL state: 42601
 Character: 21

同一查询在sqlserver,hana和oracle上有效吗?任何帮助将不胜感激

1 个答案:

答案 0 :(得分:2)

import com.toedter.calendar.JDateChooser; import java.awt.EventQueue; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.time.LocalDate; import java.time.ZoneId; import java.util.Date; import javax.swing.JFrame; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class Test { public static void main(String[] args) { new Test(); } private boolean manualDate; public Test() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { ex.printStackTrace(); } JDateChooser dateChooser = new JDateChooser(); dateChooser.addPropertyChangeListener("date", new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if (manualDate) { return; } Date newDate = (Date) evt.getNewValue(); Date oldDate = (Date) evt.getOldValue(); if (newDate != null && oldDate != null) { LocalDate newLD = LocalDate.ofInstant(newDate.toInstant(), ZoneId.systemDefault()); LocalDate oldLD = LocalDate.ofInstant(oldDate.toInstant(), ZoneId.systemDefault()); if (newLD.equals(oldLD)) { return; } } System.out.println(evt.getPropertyName()); } }); manualDate = true; dateChooser.setDate(new Date()); manualDate = false; JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(dateChooser); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } } 是保留关键字,您必须引用它:

desc

如果您密切注意错误消息中的select CONCAT(name, "desc") from the_table ,它将准确指向^部分,表明这是问题所在,而不是desc函数。