inquiry

Started by Jinqiang Hanalmost 23 years ago4 messages
#1Jinqiang Han
postgresql@db.pku.edu.cn

hello,

I have read the source code of postgres.c. Two strang things I can't understand.
Souce code of Postgres.c:
..
Foreach(parsetree_list的元素parsetree){ //In what situation here will be many parsetrees?

(List *)querytree_list = pg_analyze_and_rewrite(parsetree);
foreach(querytree_list中的每个querytree){ //In what situation here will be many querytrees?

Who can tell me the reason?
Thank you very much

Jinqiang Han

#2Bruce Momjian
pgman@candle.pha.pa.us
In reply to: Jinqiang Han (#1)
Re: inquiry

Jinqiang Han wrote:

hello,

I have read the source code of postgres.c. Two strang things I can't understand.
Souce code of Postgres.c:
..
Foreach(parsetree_list������parsetree){ //In what situation here will be many parsetrees��
��

You can send multiple queries in a single string, "SELECT;SELECT".

(List *)querytree_list = pg_analyze_and_rewrite(parsetree);
foreach(querytree_list��������querytree){ //In what situation here will be many querytrees��

A RULE may have additional queries to fire.

Who can tell me the reason?
Thank you very much

Jinqiang Han

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#3Jinqiang Han
postgresql@db.pku.edu.cn
In reply to: Bruce Momjian (#2)
Re: inquiry

hi,Bruce Momjian

I think you are wrong. multiple query in a string, such as ""SELECT;SELECT" will invoke pg_execute_query_string twice, It won't generate two parsetree.

======= 2003-03-26 10:20:00 您在来信中写道:=======

Jinqiang Han wrote:

hello,

I have read the source code of postgres.c. Two strang things I can't understand.
Souce code of Postgres.c:
..
Foreach(parsetree_list的元素parsetree){ //In what situation here will be many parsetrees?

You can send multiple queries in a single string, "SELECT;SELECT".

(List *)querytree_list = pg_analyze_and_rewrite(parsetree);
foreach(querytree_list中的每个querytree){ //In what situation here will be many querytrees?

A RULE may have additional queries to fire.

Who can tell me the reason?
Thank you very much

Jinqiang Han

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

--
Bruce Momjian                        |  http://candle.pha.pa.us
pgman@candle.pha.pa.us               |  (610) 359-1001
+  If your life is a hard drive,     |  13 Roberts Road
+  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

.

= = = = = = = = = = = = = = = = = = = =

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Jinqiang Han (#3)
Re: inquiry

"Jinqiang Han" <postgresql@db.pku.edu.cn> writes:

hi,Bruce Momjian
I think you are wrong. multiple query in a string, such as ""SELECT;SELECT" will invoke pg_execute_query_string twice, It won't generate two parsetree.

Try it in something other than psql. psql splits such a string into
multiple submissions to the backend --- but other interfaces don't.

regards, tom lane