在线精品99_中国九九盗摄偷拍偷看_91免费版在线观看_91.app_91高清视频在线_99热最新网站

PostgreSQL如何实现上拉子链接

143次阅读
没有评论

共计 3829 个字符,预计需要花费 10 分钟才能阅读完成。

这篇文章主要介绍了 PostgreSQL 如何实现上拉子链接,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让丸趣 TV 小编带着大家一起了解一下。

按官方文档的介绍, 子链接 Sublink 代表的是出现在表达式 (可能会出现组合运算符) 中的子查询, 子查询的类型包括:
EXISTS_SUBLINK
语法:EXISTS(SELECT …)

select * 
from t_dwxx a
where exists (select b.dwbh from t_grxx b where a.dwbh = b.dwbh);

ALL_SUBLINK
语法:(lefthand) op ALL (SELECT …)

select * 
from t_dwxx a
where dwbh   all (select b.dwbh from t_grxx b);

ANY_SUBLINK
语法:(lefthand) op ANY (SELECT …)

select * 
from t_dwxx a
where dwbh = any (select b.dwbh from t_grxx b);

ROWCOMPARE_SUBLINK
语法:(lefthand) op (SELECT …)

select * 
from t_dwxx a
where dwbh   (select max(b.dwbh) from t_grxx b);

EXPR_SUBLINK
语法:(SELECT with single targetlist item …)

select *,(select max(dwbh) from t_grxx) 
from t_dwxx a;

MULTIEXPR_SUBLINK
语法:(SELECT with multiple targetlist items …)

ARRAY_SUBLINK
语法:ARRAY(SELECT with single targetlist item …)

CTE_SUBLINK
语法:
WITH query (never actually part of an expression)

官方说明:

/*
 * SubLink
 *
 * A SubLink represents a subselect appearing in an expression, and in some
 * cases also the combining operator(s) just above it. The subLinkType
 * indicates the form of the expression represented:
 * EXISTS_SUBLINK EXISTS(SELECT ...)
 * ALL_SUBLINK (lefthand) op ALL (SELECT ...)
 * ANY_SUBLINK (lefthand) op ANY (SELECT ...)
 * ROWCOMPARE_SUBLINK (lefthand) op (SELECT ...)
 * EXPR_SUBLINK (SELECT with single targetlist item ...)
 * MULTIEXPR_SUBLINK (SELECT with multiple targetlist items ...)
 * ARRAY_SUBLINK ARRAY(SELECT with single targetlist item ...)
 * CTE_SUBLINK WITH query (never actually part of an expression)
 * For ALL, ANY, and ROWCOMPARE, the lefthand is a list of expressions of the
 * same length as the subselect s targetlist. ROWCOMPARE will *always* have
 * a list with more than one entry; if the subselect has just one target
 * then the parser will create an EXPR_SUBLINK instead (and any operator
 * above the subselect will be represented separately).
 * ROWCOMPARE, EXPR, and MULTIEXPR require the subselect to deliver at most
 * one row (if it returns no rows, the result is NULL).
 * ALL, ANY, and ROWCOMPARE require the combining operators to deliver boolean
 * results. ALL and ANY combine the per-row results using AND and OR
 * semantics respectively.
 * ARRAY requires just one target column, and creates an array of the target
 * column s type using any number of rows resulting from the subselect.
 * 
 *  子链接属于 Expr Node, 但并不意味着子链接是可以执行的. 子链接必须在计划期间通过子计划节点在表达式树中替换
 * SubLink is classed as an Expr node, but it is not actually executable;
 * it must be replaced in the expression tree by a SubPlan node during
 * planning.
 *
 * NOTE: in the raw output of gram.y, testexpr contains just the raw form
 * of the lefthand expression (if any), and operName is the String name of
 * the combining operator. Also, subselect is a raw parsetree. During parse
 * analysis, the parser transforms testexpr into a complete boolean expression
 * that compares the lefthand value(s) to PARAM_SUBLINK nodes representing the
 * output columns of the subselect. And subselect is transformed to a Query.
 * This is the representation seen in saved rules and in the rewriter.
 *
 * In EXISTS, EXPR, MULTIEXPR, and ARRAY SubLinks, testexpr and operName
 * are unused and are always null.
 *
 * subLinkId is currently used only for MULTIEXPR SubLinks, and is zero in
 * other SubLinks. This number identifies different multiple-assignment
 * subqueries within an UPDATE statement s SET list. It is unique only
 * within a particular targetlist. The output column(s) of the MULTIEXPR
 * are referenced by PARAM_MULTIEXPR Params appearing elsewhere in the tlist.
 *
 * The CTE_SUBLINK case never occurs in actual SubLink nodes, but it is used
 * in SubPlans generated for WITH subqueries.
 */
typedef enum SubLinkType
 EXISTS_SUBLINK,
 ALL_SUBLINK,
 ANY_SUBLINK,
 ROWCOMPARE_SUBLINK,
 EXPR_SUBLINK,
 MULTIEXPR_SUBLINK,
 ARRAY_SUBLINK,
 CTE_SUBLINK /* for SubPlans only */
} SubLinkType;

正文完
 
丸趣
版权声明:本站原创文章,由 丸趣 2023-07-20发表,共计3829字。
转载说明:除特殊说明外本站除技术相关以外文章皆由网络搜集发布,转载请注明出处。
评论(没有评论)
主站蜘蛛池模板: 欧美又大又硬又粗bbbbb | 国产成人精品久久亚洲高清不卡 | 久久人午夜亚洲精品无码区 | 亚洲成av人片无码天堂下载 | 韩国一级特黄毛片大 | 亚洲精品久久九九热 | 综合区 小说区 图片区 | 国产精品久久久久不卡绿巨人 | 久久成人国产精品一区二区 | 国产一区二区三区四区 | 婷婷五月综合缴情在线视频 | 亚洲精品xxxx | 日本免费一二区 | 亚洲欧美第一成人网站7777 | 在线观看网站国产 | 美女大量吞精在线观看456 | 国产成人精品实拍在线 | 在线观看做爰视频成人 | 国产成人黄色在线观看 | 男人下部进女人下部视频 | 好日子在线观看视频大全免费动漫 | 精品国品一二三产品区别在线观看 | 99久久爱re热6在播放 | 狠狠色丁香婷婷久久综合 | 最近中文字幕免费在线看 | 一个人看的www片免费视频中文 | 欧美亚洲国产精品久久蜜芽直播 | 亚洲mv大片欧洲mv大片 | 色老板精品视频在线观看 | 亚洲伊人久久精品酒店 | 亚洲国产精品+制服丝袜 | 99热这里只有精品第一页 | 日韩精品视频在线播放 | 久久丫精品国产亚洲av不卡 | 福利啪啪| 免费极品av一视觉盛宴 | 欧美性猛交xxxx乱大交极品 | 四虎影视永久 | 国产精品色内内在线播放 | 久久人人爽人人爽人人片av麻烦 | 久久综合伊人77777 |