title: Use postgres constants with pg_prepare/pg_execute
body: <p>Supposing this table:</p>
  <pre class="lang-sql prettyprint-override"><code>CREATE TABLE log
  (
    user smallint NOT NULL,
    moment timestamp without time zone NOT NULL DEFAULT (clock_timestamp())::timestamp without time zone,
    details text NOT NULL,
    CONSTRAINT log_pk PRIMARY KEY (user, moment)
  );
  </code></pre>
  <p>To add a record to the table, I would use the following code:</p>
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  
    $dbconn = pg_connect('dbname=system');
  
    $query = &lt;&lt;&lt;EOQ
  INSERT INTO
    log
  VALUES
    (
      $1,
      DEFAULT,
      $3
    )
  EOQ;
  
  // ...
  </code></pre>
  <p>With the 'DEFAULT' constant as the second parameter, but for a &quot;collection of bizarre reasons&quot; I need to be able to run it like this:</p>
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  
    $dbconn = pg_connect('dbname=system');
  
    $query = &lt;&lt;&lt;EOQ
  INSERT INTO
    log
  VALUES
    (
      $1,
      $2,
      $3
    )
  EOQ;
  
    $result = pg_prepare($dbconn, '', $query);
  
    $data=
      [
        10,
        'DEFAULT',
        'IP: 127.0.0.1'
      ];
  
    $result = pg_execute($dbconn, '', $data);
  </code></pre>
  <p>The problem is that, in this way, the constant is received as text and php raise the error '<em>PHP Warning: pg_execute(): Query failed: ERROR: invalid input syntax for type timestamp: &quot;DEFAULT&quot;</em>'.</p>
  <p>Is there any way to use postgres constants as parameters with pg_prepare/pg_execute?</p>
  <p>PS: I'm using php 8 and postgres 13.4</p>
  <p><strong>EDIT:</strong></p>
  <p>I also tried using this format:</p>
  <pre class="lang-php prettyprint-override"><code>
  // ...
  
    $query = &lt;&lt;&lt;EOQ
  INSERT INTO
    acessos
  VALUES
    (
      $1,
      CASE WHEN $2='DEFAULT' THEN
        DEFAULT
      ELSE
        $2
      END,
      $3
    )
  EOQ;
  
  // ...
  
  </code></pre>
  <p>but I got another error message, '<em>PHP Warning:  pg_prepare(): Query failed: ERROR:  DEFAULT is not allowed in this context</em>'...</p>