title: postgres: can I prepare unnamed statement from SQL
body: <p><a href="https://www.postgresql.org/docs/current/static/libpq-exec.html" rel="nofollow noreferrer">https://www.postgresql.org/docs/current/static/libpq-exec.html</a>
  next to <code>PQprepare</code>:</p>
  
  <blockquote>
    <p>The function creates a prepared statement named <em>stmtName</em> from the
    query string, which must contain a single SQL command. <em>stmtName</em> can be
    "" to create an unnamed statement, in which case any pre-existing
    unnamed statement is automatically replaced; otherwise it is an error
    if the statement name is already defined in the current session.</p>
  </blockquote>
  
  <p>and further:</p>
  
  <blockquote>
    <p>Prepared statements for use with <em>PQexecPrepared</em> can also be created by
    executing SQL <code>PREPARE</code> statements.</p>
  </blockquote>
  
  <p>now <a href="https://www.postgresql.org/docs/current/static/sql-prepare.html" rel="nofollow noreferrer">https://www.postgresql.org/docs/current/static/sql-prepare.html</a></p>
  
  <blockquote>
    <p>PREPARE name [ ( data_type [, ...] ) ] AS statement</p>
  </blockquote>
  
  <p>and:</p>
  
  <blockquote>
    <p>name An arbitrary name given to this particular prepared statement. It
    must be unique within a single session and is subsequently used to
    execute or deallocate a previously prepared statement.</p>
  </blockquote>
  
  <p><strong>Question:</strong>
  Can I not create unnamed prepared statement using SQL statement <code>PREPARE</code>? silently reusable and all the rest...</p>
  
  <pre><code>t=# prepare ""(int) as select $1,now();
  ERROR:  zero-length delimited identifier at or near """"
  LINE 1: prepare ""(int) as select $1,now();
  </code></pre>
  
  <p>and ommiting the name:</p>
  
  <pre><code>ERROR:  syntax error at or near "as"
  </code></pre>
  
  <p>Or I'm missing something very obvious?..</p>