summaryrefslogtreecommitdiffstats
path: root/doc/src/sgml/html/typeconv-select.html
diff options
context:
space:
mode:
Diffstat (limited to 'doc/src/sgml/html/typeconv-select.html')
-rw-r--r--doc/src/sgml/html/typeconv-select.html30
1 files changed, 30 insertions, 0 deletions
diff --git a/doc/src/sgml/html/typeconv-select.html b/doc/src/sgml/html/typeconv-select.html
new file mode 100644
index 0000000..bf4d5d8
--- /dev/null
+++ b/doc/src/sgml/html/typeconv-select.html
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>10.6. SELECT Output Columns</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="typeconv-union-case.html" title="10.5. UNION, CASE, and Related Constructs" /><link rel="next" href="indexes.html" title="Chapter 11. Indexes" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">10.6. <code class="literal">SELECT</code> Output Columns</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="typeconv-union-case.html" title="10.5. UNION, CASE, and Related Constructs">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="typeconv.html" title="Chapter 10. Type Conversion">Up</a></td><th width="60%" align="center">Chapter 10. Type Conversion</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 15.5 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="indexes.html" title="Chapter 11. Indexes">Next</a></td></tr></table><hr /></div><div class="sect1" id="TYPECONV-SELECT"><div class="titlepage"><div><div><h2 class="title" style="clear: both">10.6. <code class="literal">SELECT</code> Output Columns</h2></div></div></div><a id="id-1.5.9.11.2" class="indexterm"></a><p>
+The rules given in the preceding sections will result in assignment
+of non-<code class="type">unknown</code> data types to all expressions in an SQL query,
+except for unspecified-type literals that appear as simple output
+columns of a <code class="command">SELECT</code> command. For example, in
+
+</p><pre class="screen">
+SELECT 'Hello World';
+</pre><p>
+
+there is nothing to identify what type the string literal should be
+taken as. In this situation <span class="productname">PostgreSQL</span> will fall back
+to resolving the literal's type as <code class="type">text</code>.
+</p><p>
+When the <code class="command">SELECT</code> is one arm of a <code class="literal">UNION</code>
+(or <code class="literal">INTERSECT</code> or <code class="literal">EXCEPT</code>) construct, or when it
+appears within <code class="command">INSERT ... SELECT</code>, this rule is not applied
+since rules given in preceding sections take precedence. The type of an
+unspecified-type literal can be taken from the other <code class="literal">UNION</code> arm
+in the first case, or from the destination column in the second case.
+</p><p>
+<code class="literal">RETURNING</code> lists are treated the same as <code class="command">SELECT</code>
+output lists for this purpose.
+</p><div class="note"><h3 class="title">Note</h3><p>
+ Prior to <span class="productname">PostgreSQL</span> 10, this rule did not exist, and
+ unspecified-type literals in a <code class="command">SELECT</code> output list were
+ left as type <code class="type">unknown</code>. That had assorted bad consequences,
+ so it's been changed.
+ </p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="typeconv-union-case.html" title="10.5. UNION, CASE, and Related Constructs">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="typeconv.html" title="Chapter 10. Type Conversion">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="indexes.html" title="Chapter 11. Indexes">Next</a></td></tr><tr><td width="40%" align="left" valign="top">10.5. <code class="literal">UNION</code>, <code class="literal">CASE</code>, and Related Constructs </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 15.5 Documentation">Home</a></td><td width="40%" align="right" valign="top"> Chapter 11. Indexes</td></tr></table></div></body></html> \ No newline at end of file