CLOSE <refpurpose>close a cursor</refpurpose> — カーソルを閉じる
CLOSE { name | ALL }
   <command>CLOSE</command> frees the resources associated with an open cursor.
   After the cursor is closed, no subsequent operations
   are allowed on it. A cursor should be closed when it is
   no longer needed.
CLOSEは、開いたカーソルに関連するリソースを解放します。
カーソルが閉じられた後は、そのカーソルに対する操作はできません。
カーソルは必要がなくなった時点で閉じるべきです。
  
   Every non-holdable open cursor is implicitly closed when a
   transaction is terminated by <command>COMMIT</command> or
   <command>ROLLBACK</command>.  A holdable cursor is implicitly
   closed if the transaction that created it aborts via
   <command>ROLLBACK</command>.  If the creating transaction
   successfully commits, the holdable cursor remains open until an
   explicit <command>CLOSE</command> is executed, or the client
   disconnects.
トランザクションがCOMMITもしくはROLLBACKで終了された時点で、開いている保持不可能カーソルは全て暗黙的に閉じられます。
ROLLBACKにより保持可能カーソルを作成したトランザクションをアボートした場合、この保持可能カーソルは暗黙的に閉じられます。
作成したトランザクションが正常にコミットされた場合、保持可能カーソルは明示的にCLOSEが実行されるまで、あるいは、クライアントとの接続が切断されるまで、開いたままになります。
  
nameThe name of an open cursor to close. 閉じる対象となる、現在開いているカーソルの名前です。
ALLClose all open cursors. すべてのカーソルを閉じます。
   <productname>PostgreSQL</productname> does not have an explicit
   <command>OPEN</command> cursor statement; a cursor is considered
   open when it is declared.  Use the
   <link linkend="sql-declare"><command>DECLARE</command></link>
   statement to declare a cursor.
PostgreSQLには明示的なカーソルのOPEN文がありません。
カーソルは宣言された時に開いたとみなされます。
カーソルの宣言にはDECLARE文を使用してください。
  
   You can see all available cursors by querying the <link
   linkend="view-pg-cursors"><structname>pg_cursors</structname></link> system view.
pg_cursorsシステムビューを問い合わせることにより利用可能なすべてのカーソルを確認することができます。
  
   If a cursor is closed after a savepoint which is later rolled back,
   the <command>CLOSE</command> is not rolled back; that is, the cursor
   remains closed.
カーソルがセーブポイントの後に閉じられ、後にロールバックした場合には、CLOSEはロールバックされません。
つまり、そのカーソルは閉じたままとなります。
  
   Close the cursor <literal>liahona</literal>:
カーソルliahonaを閉じます。
CLOSE liahona;
   <command>CLOSE</command> is fully conforming with the SQL
   standard. <command>CLOSE ALL</command> is a <productname>PostgreSQL</productname>
   extension.
CLOSEは標準SQLと完全な互換性を持ちます。
ただし、CLOSE ALLはPostgreSQLの拡張です。