title: What is the equivalent of datetime.datetime.now() in postgres?
body: <p>I have my code and want to return the current time in SQL (I'm using postgres).</p>
  <pre><code>procedure = PGFunction(
    schema=&quot;public&quot;,
    signature=&quot;in_out(_profile_id integer, _item_id integer, _channel_id integer, _allowed Boolean, _source_datetime timestamp)&quot;,
    definition=&quot;&quot;&quot;\
  RETURNS boolean
  LANGUAGE sql AS $$
      INSERT INTO local_cache(profile_id, item_id, channel_id, source_datetime)
      VALUES(_profile_id, _item_id, _channel_id, _source_datetime)
      ON CONFLICT ON CONSTRAINT local_cache_pkey
      DO UPDATE local_cache
      SET source_datetime = CURRENT_TIMESTAMP??
      WHERE _source_datetime &gt; source_datetime
      AND profile_id = _profile_id 
      AND item_id = _item_id 
      AND channel_id = _channel_id
  $$;&quot;&quot;&quot;
  )
  </code></pre>
  <p>Is it &quot;CURRENT_TIMESTAMP&quot;? Also how do I return a row count in SQL showing how many rows were affected by the execution of this stored procedure (how many rows were updated, not updated)? I'm not sure if I should use SELECT COUNT(*) it'd be rather slow</p>