In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail how to use the USER keyword in PostgreSQL, and the content of the article is of high quality, so the editor will share it with you for reference. I hope you will have some understanding of the relevant knowledge after reading this article.
Someone switched from MySQL to PG, and the structure of the user table is about this.
CREATE TABLE "user" (userid int,username text,...)
It is not possible without double quotation marks, USER is a reserved keyword.
Guess that some kind of GUI tool is used to build the table, which automatically puts double quotation marks on the table name, so there is no problem in creating it.
Run SQL:SELECT * FROM user through JDBC
Then rs.getString (2) tries to fetch the user name and is told to exceed the range of columns. The problem was not solved until we noticed that the table was called user.
Let's give it a try. Both ways are fine.
Flying=# select user; user- quanzl (1 row) flying=# select * from user; user- quanzl (1 row)
What grammatical element is user? It can appear both in the target list as a pseudo column and in the FROM list as a pseudo table that returns the result set (the word I invented myself). The former is easy to understand. Let's take a look at the latter.
From_clause: FROM from_list {$$= $2;} | / * EMPTY*/ {$$= NIL;}; from_list: table_ref {$$= list_make1 ($1);} | from_list', 'table_ref {$$= lappend ($1, $3);}
This is the syntax definition of the FROM clause, which is part of the definition of table_ref
| | func_table func_alias_clause {RangeFunction * n = (RangeFunction *) $1; n-> alias = linitial ($2); n-> coldeflist = lsecond ($2); $$= (Node *) n;} |
Func_table definition
Func_table: func_expr_windowless opt_ordinality
Func_expr_windowless definition
Func_expr_windowless: func_application {$$= $1;} | func_expr_common_subexpr {$$= $1;}
In func_expr_common_subexpr grammatical structure
| | USER {$$= makeSQLValueFunction (SVFOP_USER,-1, @ 1);} |
That's where FROM user came from.
On how to use the USER keyword in PostgreSQL to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.