Re: About Maximum number of columns - Mailing list pgsql-general

From Richard Huxton
Subject Re: About Maximum number of columns
Date
Msg-id 43AA97D6.2080609@archonet.com
Whole thread Raw
In response to Re: About Maximum number of columns  (zhaoxin <zhaox@necas.nec.com.cn>)
List 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

pgsql-general by date:

Previous
From: Tino Wildenhain
Date:
Subject: Re: About Maximum number of columns
Next
From: Zlatko Matić
Date:
Subject: ODBC connection string, MS Access