title: AWS Redshift Leader Node-Only Function with table reference
body: <p>I have a requirement to pass the server address, server port, and the count from a table in one query in AWS Redshift. i.e. </p>
  
  <pre><code>select inet_server_addr(), inet_server_port(), count(*) from my_table;
  </code></pre>
  
  <blockquote>
    <p>ERROR: 0A000: Specified types or functions (one per INFO message) not
    supported on Redshift tables.</p>
  </blockquote>
  
  <p>I understand that this query does not work because I am trying to execute a <a href="http://docs.aws.amazon.com/redshift/latest/dg/c_SQL_functions_leader_node_only.html" rel="nofollow noreferrer">Leader Node-Only Function</a> in conjunction with a query which needs to access the compute nodes.</p>
  
  <p>I am wondering, however, if there is a work around available to get the information that I need in one query execution.</p>
  
  <p>Note: Editing the above query to use common table expressions (cte), sub-queries, views, scalar-functions etc results in the same error message.</p>
  
  <p>Note 2: PostgreSQL System information functions like <code>inet_server_addr()</code> are currently <a href="http://docs.aws.amazon.com/redshift/latest/dg/c_unsupported-postgresql-functions.html" rel="nofollow noreferrer">unsupported in AWS Redshift</a>, however, they work when called without a table reference.</p>