The Drop Command (Commands) implements:
/* * Drop one or more objects. * * We don ' t currently handle all object types here. Relations, for example, * require special handling, because (for example) indexes has additional * locking requirements. * Objects first, and then delete them in a single * Performmultipledeletions () call. This avoids unnecessary DROP RESTRICT * Errors If there is dependencies between them. */voidremoveobjects (dropstmt *stmt)/* Dispatch function for dropstmt */static voidexecdropstmt (dropstmt *stmt, BOOL IsT Oplevel) {switch (stmt->removetype) {case object_index:if (stmt->concurrent) Preventtransactionchain ( Istoplevel, "DROP INDEX concurrently");/* Fall through */case object_table:case object_sequence:case object_view:case Object_matview:case object_foreign_table:removerelations (stmt); break;default:removeobjects (stmt); break;}} /* * Standard_processutility itself deals only with utility commands for * which we don't provide event trigger support. Commands that does have * suchSupport is passed down to Processutilityslow, which contains the * necessary infrastructure for such triggers. * * This division isn't just for Performance:it's critical that the "event trigger code not being invoked when doing START TRANSACTION for * example, because we might need to refresh the event trigger cache, * which requires being in a valid TR Ansaction. */voidstandard_processutility (Node *parsetree,const char *querystring,processutilitycontext context,ParamListInfo Params,destreceiver *dest,char *completiontag)//* processutility *general utility function Invoker * *parsetree:the pars E Tree for the utility statement *querystring:original source text of command *context:identifies source of statement (t Oplevel client command, *non-toplevel Client command, subcommand of a larger utility command) *params:parameters to use D Uring execution *dest:where to send results *completiontag:points to a buffer of size completion_tag_bufsize *in which t o Store a command completion StATUs string. * * Notes:as of PG 8.4, caller must supply a queryString; It is not * allowed anymore to pass NULL. (If you really don't have the source text, * You can pass a constant string, perhaps "(Query not available)".) * * Completiontag is only set nonempty if we want to return a nondefault status. * * Completiontag May is NULL if caller doesn ' t want a status string. */voidprocessutility (Node *parsetree, const char *querystring, Processutilitycontext context, paramlistinfo params, Destreceiver *dest, Char *completiontag)
The detailed call stack is as follows:
#0 execdropstmt (STMT=0X17E9B40, istoplevel=1 ' \001 ') at Utility.c:1349#1 0x0000000000759457 in ProcessUtilitySlow (pars ETREE=0X17E9B40, querystring=0x17e90b0 "drop table T1;", Context=process_utility_toplevel, params=0x0, dest=0x17e9ea0 , completiontag=0x7fff06aee670 "") at Utility.c:1296#2 0x0000000000758849 in Standard_processutility (parsetree= 0X17E9B40, querystring=0x17e90b0 "drop table T1;", Context=process_utility_toplevel, params=0x0, dest=0x17e9ea0, compl etiontag=0x7fff06aee670 "") at Utility.c:792#3 0x0000000000757c88 in Processutility (PARSETREE=0X17E9B40, queryString= 0x17e90b0 "drop table T1;", Context=process_utility_toplevel, params=0x0, dest=0x17e9ea0, completiontag=0x7fff06aee67 0 "") at Utility.c:310#4 0x0000000000756e92 in Portalrunutility (PORTAL=0X1822D70, UTILITYSTMT=0X17E9B40, isTopLevel=1 ' \001 ', dest=0x17e9ea0, completiontag=0x7fff06aee670 "") at Pquery.c:1187#5 0x0000000000757048 in PortalRunMulti (Porta L=0X1822D70, istoplevel=1 ' \001 ', dest=0X17E9EA0, altdest=0x17e9ea0, completiontag=0x7fff06aee670 "") at Pquery.c:1318#6 0x000000000075661c in PortalRun ( PORTAL=0X1822D70, count=9223372036854775807, istoplevel=1 ' \001 ', dest=0x17e9ea0, altdest=0x17e9ea0, completionTag= 0x7fff06aee670 "") at Pquery.c:816#7 0x0000000000750944 in Exec_simple_query (query_string=0x17e90b0 "drop table T1;") At Postgres.c:1045#8 0x0000000000754967 in Postgresmain (Argc=1, argv=0x1784148, dbname=0x1784130 "Wzy", username= 0x1784110 "Xiaochu.yh") at Postgres.c:4004#9 0x00000000006e80ba in Backendrun (port=0x17a3e00) at postmaster.c:4117#10 0 X00000000006E77FD in Backendstartup (port=0x17a3e00) at postmaster.c:3791#11 0x00000000006e41b2 in ServerLoop () at postm Aster.c:1570#12 0x00000000006e392e in Postmastermain (argc=3, argv=0x1783380) at postmaster.c:1223#13 0x000000000064d3d3 in Main (argc=3, argv=0x1783380) at main.c:225
Portal, the meaning of the entrance.
SQL statements (Planable SQL) that can generate execution plans are handled through Processquery, and for SQL statements that cannot generate execution plans, named command SQL, are handled by portalrunutility.
Reference:
1. GDB uses http://blog.chinaunix.net/uid-20788636-id-1841301.html
2. Postgre compile and install boot http://blog.chinaunix.net/uid-11161675-id-2903295.html
3. Postgre Official Document Http://www.postgresql.org/docs/current/static/index.html
4. How to do postgre source analysis http://blog.csdn.net/anzelin_ruc/article/details/8622770
PostgreSQL performs the overall process of command-type SQL such as drop table