Re: About Maximum number of columns

From: Richard Huxton <dev(at)archonet(dot)com>
To: zhaoxin <zhaox(at)necas(dot)nec(dot)com(dot)cn>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: About Maximum number of columns
Date: 2005-12-22 12:11:02
Message-ID: 43AA97D6.2080609@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

zhaoxin wrote:
> I have to face this trouble , it is not I want , but a historical problem .
> so , can you tell me ?

Sure, but you'll need to say what column-types you have.

Below is a small script to generate a table with lots of columns.

#!/bin/perl -w
use strict;

my $tbl = 'test_text';
my $typ = 'text';
my $num_cols = 1500;

print "CREATE TABLE $tbl (\n";
for (my $c=0; $c<$num_cols; $c++) {
print " col$c $typ,\n";
}
print "PRIMARY KEY (col0)\n";
print ");\n";
exit;

You can run it with something like:
perl mk_script.pl | psql -Urichardh richardh

--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Chris Browne 2005-12-22 13:51:39 Re: contrib extenstions
Previous Message Tino Wildenhain 2005-12-22 12:10:07 Re: About Maximum number of columns