Grokbase
x

Howard Wilkinson (h...@cohtech.com)

Profile | Posts (1)

User Information

Display Name:Howard Wilkinson
Partial Email Address:h...@cohtech.com
Posts:
1 total
1 in PostgreSQL - General

2 Most Recent

1) Howard Wilkinson Re: [GENERAL] Querying the schema for column widths - what syntax do I use?
| +1 vote
This is a multi-part message in MIME format. Content-Type: text/plain; charset=ISO-8859-1;...
PostgreSQL - General
[ Profile | Reply to group ] [ Flat  Thread  Threaded ]
This is a multi-part message in MIME format.
--------------010608020605080903030009
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Richard Huxton wrote:
> Howard Wilkinson wrote:
>> I am working on some upgrades to the MyDNS open source product. I
>> have some expertise in MySQL but am not overly familiar with
>> PostgreSQL and need some guidance on how to query the schema for the
>> maximum size of data a column can hold.
>
> Unless you're after PG-specific stuff, it's probably best to use the
> information-schema.
>
> http://www.postgresql.org/docs/8.3/static/information-schema.html
>
> This has a standard layout cross-database, so will help you to extend
> you app across other systems. I think it's supported in the latest
> version of MySQL too.
>
SO I can do something like this?

select character_maximum_length from information_schema.columns where
table_name='rr' and column_name='data';

Yes?

--

Howard Wilkinson



Phone:



+44(20)76907075

Coherent Technology Limited



Fax:





23 Northampton Square,



Mobile:



+44(7980)639379

United Kingdom, EC1V 0HL



Email:



[email protected: h...@cohtech.com]




--------------010608020605080903030009
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Richard Huxton wrote:
<blockquote cite="mid:47BD5B48.4020505@archonet.com" type="cite">Howard
Wilkinson wrote:
  <br>
  <blockquote type="cite">I am working on some upgrades to the MyDNS
open source product. I have some expertise in MySQL but am not overly
familiar with PostgreSQL and need some guidance on how to query the
schema for the maximum size of data a column can hold.
    <br>
  </blockquote>
  <br>
Unless you're after PG-specific stuff, it's probably best to use the
information-schema.
  <br>
  <br>
<a class="moz-txt-link-freetext" href="http://www.postgresql.org/docs/8.3/static/information-schema.html">http://www.postgresql.org/docs/8.3/static/information-schema.html</a>
  <br>
  <br>
This has a standard layout cross-database, so will help you to extend
you app across other systems. I think it's supported in the latest
version of MySQL too.
  <br>
  <br>
</blockquote>
SO I can do something like this?<br>
<br>
select character_maximum_length from information_schema.columns where
table_name='rr' and column_name='data';<br>
<br>
Yes?<br>
<br>
<div class="moz-signature">-- <br>
<title>Signature</title>
<div class="Section1">
<table class="MsoNormalTable" style="width: 100%;" border="0"
cellpadding="0" width="100%">
  <tbody>
    <tr style="">
      <td style="padding: 1.5pt;" valign="top">
      <p class="MsoNormal">Howard Wilkinson</p>
      </td>
      <td style="padding: 1.5pt;" valign="top">
      <p class="MsoNormal">Phone:</p>
      </td>
      <td style="padding: 1.5pt;" valign="top">
      <p class="MsoNormal">+44(20)76907075</p>
      </td>
    </tr>
    <tr style="">
      <td style="padding: 1.5pt;" valign="top">
      <p class="MsoNormal">Coherent Technology Limited</p>
      </td>
      <td style="padding: 1.5pt;" valign="top">
      <p class="MsoNormal">Fax:</p>
      </td>
      <td style="padding: 1.5pt;" valign="top">
      <p class="MsoNormal"> </p>
      </td>
    </tr>
    <tr style="">
      <td style="padding: 1.5pt;" valign="top">
      <p class="MsoNormal">23 Northampton Square,</p>
      </td>
      <td style="padding: 1.5pt;" valign="top">
      <p class="MsoNormal">Mobile:</p>
      </td>
      <td style="padding: 1.5pt;" valign="top">
      <p class="MsoNormal">+44(7980)639379</p>
      </td>
    </tr>
    <tr style="">
      <td style="padding: 1.5pt;" valign="top">
      <p class="MsoNormal">United Kingdom, EC1V 0HL</p>
      </td>
      <td style="padding: 1.5pt;" valign="top">
      <p class="MsoNormal">Email:</p>
      </td>
      <td style="padding: 1.5pt;" valign="top">
<p class="MsoNormal"><a name="howardcohtech.com"></a><a class="moz-txt-link-abbreviated" href="mailto:howard@cohtech.com">howard@cohtech.com</a></p>
      </td>
    </tr>
  </tbody>
</table>
<p class="MsoNormal"> </p>
</div>
</div>
</body>
</html>

--------------010608020605080903030009--
2) Howard Wilkinson [GENERAL] Querying the schema for column widths - what syntax do I use?
| +1 vote
I am working on some upgrades to the MyDNS open source product. I have some expertise in MySQL but...
PostgreSQL - General
[ Profile | Reply to group ] [ Flat  Thread  Threaded ]
I am working on some upgrades to the MyDNS open source product. I have
some expertise in MySQL but am not overly familiar with PostgreSQL and
need some guidance on how to query the schema for the maximum size of
data a column can hold.

In MySQL I can do either: a "DESCRIBE" command or do "SELECT COLUMNS"
command. And then parse the result for the length in the type column of
the row returned. How would I do a similar function using PostgreSQL - I
have tried to find this in the manuals and in this mailing list but not
found any pointers to get me started.

Apologies for asking such a simple question but I am being a bit lazy as
I want to get on with releasing the MyDNS code.

Regards, Howard.


---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org/

spacer
Profile | Posts (1)
Home > People > Howard Wilkinson