MCPcopy Create free account
hub / github.com/apache/cloudberry / pg_parse_query

Function pg_parse_query

src/backend/tcop/postgres.c:741–778  ·  view source on GitHub ↗

* Do raw parsing (only). * * A list of parsetrees (RawStmt nodes) is returned, since there might be * multiple commands in the given string. * * NOTE: for interactive queries, it is important to keep this routine * separate from the analysis & rewrite stages. Analysis and rewriting * cannot be done in an aborted transaction, since they require access to * database tables. So, we rely on

Source from the content-addressed store, hash-verified

739 * commands are not processed any further than the raw parse stage.
740 */
741List *
742pg_parse_query(const char *query_string)
743{
744 List *raw_parsetree_list;
745
746 TRACE_POSTGRESQL_QUERY_PARSE_START(query_string);
747
748 if (log_parser_stats)
749 ResetUsage();
750
751 raw_parsetree_list = raw_parser(query_string, RAW_PARSE_DEFAULT);
752
753 if (log_parser_stats)
754 ShowUsage("PARSER STATISTICS");
755
756#ifdef COPY_PARSE_PLAN_TREES
757 /* Optional debugging check: pass raw parsetrees through copyObject() */
758 {
759 List *new_list = copyObject(raw_parsetree_list);
760
761 /* This checks both copyObject() and the equal() routines... */
762 if (!equal(new_list, raw_parsetree_list))
763 elog(WARNING, "copyObject() failed to produce an equal raw parse tree");
764 else
765 raw_parsetree_list = new_list;
766 }
767#endif
768
769 /*
770 * Currently, outfuncs/readfuncs support is missing for many raw parse
771 * tree nodes, so we don't try to implement WRITE_READ_PARSE_PLAN_TREES
772 * here.
773 */
774
775 TRACE_POSTGRESQL_QUERY_PARSE_DONE(query_string);
776
777 return raw_parsetree_list;
778}
779
780/*
781 * Given a raw parsetree (gram.y output), and optionally information about

Callers 13

exec_simple_queryFunction · 0.85
exec_parse_messageFunction · 0.85
shouldBypassQueryFunction · 0.85
gp_dump_query_oidsFunction · 0.85
build_querydescFunction · 0.85
execute_sql_stringFunction · 0.85
ImportForeignSchemaFunction · 0.85
ExecuteSqlStringFunction · 0.85
init_sql_fcacheFunction · 0.85
inline_functionFunction · 0.85
fmgr_sql_validatorFunction · 0.85

Calls 4

ResetUsageFunction · 0.85
raw_parserFunction · 0.85
ShowUsageFunction · 0.85
equalFunction · 0.85

Tested by 1

get_parsetree_forFunction · 0.68