<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title><![CDATA[LinLog]]></title>
    <link>https://linlog.skepticats.com/</link>
    <description><![CDATA[Linux, Programming, and Computing in General]]></description>
    <lastBuildDate>2022-09-16T16:00:21+00:00</lastBuildDate>
    <managingEditor>pageer@skepticats.com (Peter Geer)</managingEditor>
    <language>en-US</language>
    <generator>https://lnblog.skepticats.com/?v=2.2.0</generator>
    <item>
      <title><![CDATA[Formatting with psql  ]]></title>
      <link>https://linlog.skepticats.com/entries/2009/08/Formatting_with_psql.php</link>
      <description><![CDATA[<p>Yes, this is yet another &quot;reminder to myself&quot; Postgres post, because I've had to <a href="http://www.postgresql.org/files/documentation/books/aw_pgsql/node143.html">look this up</a> at least 3 times.</p><p>To turn on expanded query output formatting in psql, the Postgres command-line client, run either <code>\pset expanded</code> or simply <code>\x</code>.  They both do the same thing - make Postgres output each column in a result set as a separate line.  This is equivalent to the mysql command-line client trick of ending the query with <code>\G</code> instead of a semi-colon.</p><p>Incidentally both of the above commands are boolean toggles.  You run them once to turn on expanded formatting and run them again to turn it off.</p>]]></description>
      <author><![CDATA[pageer@skepticats.com (Peter Geer)]]></author>
      <pubDate>Tue, 18 Aug 2009 13:18:17 +0000</pubDate>
      <category><![CDATA[Database]]></category>
      <category><![CDATA[PostgreSQL]]></category>
      <guid isPermalink="true">https://linlog.skepticats.com/entries/2009/08/Formatting_with_psql.php</guid>
      <comments>https://linlog.skepticats.com/entries/2009/08/18_0918/comments/</comments>
    </item>
    <item>
      <title><![CDATA[Timestamps in PostgreSQL ]]></title>
      <link>https://linlog.skepticats.com/entries/2009/07/Timestamps_in_PostgreSQL.php</link>
      <description><![CDATA[<p>So at my new job (maybe I'll post something about that later), we use PostgreSQL for our <abbr title="Relational DataBase Management System">RDBMS</abbr>.  And, for reasons I won't get into, our application stores dates as UNIX timestamps, rather than, you know, actual <em>dates</em>.  Thus this quick note to myself so I don't have to keep looking up how to convert between the two.</p><p>Date to UNIX timestamp in Postgres (from <a href="http://www.archonet.com/pgdocs/date-to-epoch.html">this page</a>):<br /><code>select date_part('epoch',now()) as unixtime; -- This will do it.<br />select extract('epoch' from now()) as unixtime;  -- ... and so will this.</code></p><p>UNIX timestamp to Postgres TIMESTAMP (from <a href="http://www.postgresonline.com/journal/index.php?/archives/3-Converting-from-Unix-Timestamp-to-PostgreSQL-Timestamp-or-Date.html">this page</a>):<br /><code>SELECT TIMESTAMP 'epoch' + 1195374767 * INTERVAL '1 second';</code></p>]]></description>
      <author><![CDATA[pageer@skepticats.com (Peter Geer)]]></author>
      <pubDate>Thu, 23 Jul 2009 20:00:23 +0000</pubDate>
      <category><![CDATA[PostgreSQL]]></category>
      <category><![CDATA[Database]]></category>
      <guid isPermalink="true">https://linlog.skepticats.com/entries/2009/07/Timestamps_in_PostgreSQL.php</guid>
      <comments>https://linlog.skepticats.com/entries/2009/07/23_1600/comments/</comments>
    </item>
  </channel>
</rss>
