gooderp18绿色标准版
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

43 lines
4.2KB

  1. <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2. <!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>dblink_get_pkey</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 V1.79.1" /><link rel="prev" href="contrib-dblink-cancel-query.html" title="dblink_cancel_query" /><link rel="next" href="contrib-dblink-build-sql-insert.html" title="dblink_build_sql_insert" /></head><body><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">dblink_get_pkey</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="contrib-dblink-cancel-query.html" title="dblink_cancel_query">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="dblink.html" title="F.10. dblink">Up</a></td><th width="60%" align="center">F.10. dblink</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 12.4 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="contrib-dblink-build-sql-insert.html" title="dblink_build_sql_insert">Next</a></td></tr></table><hr></hr></div><div class="refentry" id="CONTRIB-DBLINK-GET-PKEY"><div class="titlepage"></div><a id="id-1.11.7.19.20.1" class="indexterm"></a><div class="refnamediv"><h2><span class="refentrytitle">dblink_get_pkey</span></h2><p>dblink_get_pkey — returns the positions and field names of a relation's
  3. primary key fields
  4. </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">
  5. dblink_get_pkey(text relname) returns setof dblink_pkey_results
  6. </pre></div><div class="refsect1" id="id-1.11.7.19.20.5"><h2>Description</h2><p>
  7. <code class="function">dblink_get_pkey</code> provides information about the primary
  8. key of a relation in the local database. This is sometimes useful
  9. in generating queries to be sent to remote databases.
  10. </p></div><div class="refsect1" id="id-1.11.7.19.20.6"><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>relname</code></em></span></dt><dd><p>
  11. Name of a local relation, for example <code class="literal">foo</code> or
  12. <code class="literal">myschema.mytab</code>. Include double quotes if the
  13. name is mixed-case or contains special characters, for
  14. example <code class="literal">"FooBar"</code>; without quotes, the string
  15. will be folded to lower case.
  16. </p></dd></dl></div></div><div class="refsect1" id="id-1.11.7.19.20.7"><h2>Return Value</h2><p>
  17. Returns one row for each primary key field, or no rows if the relation
  18. has no primary key. The result row type is defined as
  19. </p><pre class="programlisting">
  20. CREATE TYPE dblink_pkey_results AS (position int, colname text);
  21. </pre><p>
  22. The <code class="literal">position</code> column simply runs from 1 to <em class="replaceable"><code>N</code></em>;
  23. it is the number of the field within the primary key, not the number
  24. within the table's columns.
  25. </p></div><div class="refsect1" id="id-1.11.7.19.20.8"><h2>Examples</h2><pre class="screen">
  26. CREATE TABLE foobar (
  27. f1 int,
  28. f2 int,
  29. f3 int,
  30. PRIMARY KEY (f1, f2, f3)
  31. );
  32. CREATE TABLE
  33. SELECT * FROM dblink_get_pkey('foobar');
  34. position | colname
  35. ----------+---------
  36. 1 | f1
  37. 2 | f2
  38. 3 | f3
  39. (3 rows)
  40. </pre></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="contrib-dblink-cancel-query.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="dblink.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="contrib-dblink-build-sql-insert.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">dblink_cancel_query </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> dblink_build_sql_insert</td></tr></table></div></body></html>
上海开阖软件有限公司 沪ICP备12045867号-1