Skip to content

Commit 450e728

Browse files
committed
Update to my2pg 1.24.
1 parent 42f2e5b commit 450e728

File tree

1 file changed

+28
-7
lines changed

1 file changed

+28
-7
lines changed

contrib/mysql/my2pg.pl

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3636
# SUCH DAMAGE.
3737
#
38-
# $My2pg: my2pg.pl,v 1.23 2001/12/06 19:32:20 fonin Exp $
39-
# $Id: my2pg.pl,v 1.7 2002/02/08 14:47:56 momjian Exp $
38+
# $My2pg: my2pg.pl,v 1.24 2001/12/06 19:32:20 fonin Exp $
39+
# $Id: my2pg.pl,v 1.8 2002/04/24 01:42:29 momjian Exp $
4040

4141
# TODO:
4242
# + Handle SETs
@@ -47,8 +47,28 @@
4747

4848
#
4949
# $Log: my2pg.pl,v $
50-
# Revision 1.7 2002/02/08 14:47:56 momjian
51-
# Upgrade my2pg version 1.23.
50+
# Revision 1.8 2002/04/24 01:42:29 momjian
51+
# Update to my2pg 1.24.
52+
#
53+
# Revision 1.24 2002/04/20 14:15:43 fonin
54+
# Patch by Felipe Nievinski <fnievinski@terra.com.br>.
55+
# A table I was re-creating had a composite primary key, and I was using
56+
# the -d switch to maintain the table and column names
57+
# adding double quotes around them.
58+
#
59+
# The SQL code generated was something like this:
60+
#
61+
# CREATE TABLE "rinav" (
62+
# "UnidadeAtendimento" INT8 DEFAULT '0' NOT NULL,
63+
# "NumeroRinav" INT8 DEFAULT '0' NOT NULL,
64+
# -- ...
65+
# PRIMARY KEY ("UnidadeAtendimento"," NumeroRinav")
66+
# );
67+
#
68+
# Please note the space inside the second column name string in the PK
69+
# definition. Because of this PostgreSQL was not able to create the table.
70+
#
71+
# FIXED.
5272
#
5373
# Revision 1.23 2002/02/07 22:13:52 fonin
5474
# Bugfix by Hans-Juergen Schoenig <hs@cybertec.at>: additional space after
@@ -151,7 +171,7 @@
151171
$|=1;
152172

153173
print("------------------------------------------------------------------");
154-
print("\n-- My2Pg 1.23 translated dump");
174+
print("\n-- My2Pg 1.24 translated dump");
155175
print("\n--");
156176
print("\n------------------------------------------------------------------");
157177

@@ -173,7 +193,7 @@
173193
# push header to libtypes.c
174194
open(LIBTYPES,">$libtypesource");
175195
print LIBTYPES "/******************************************************";
176-
print LIBTYPES "\n * My2Pg \$Revision: 1.7 $ \translated dump";
196+
print LIBTYPES "\n * My2Pg \$Revision: 1.8 $ \translated dump";
177197
print LIBTYPES "\n * User types definitions";
178198
print LIBTYPES "\n ******************************************************/";
179199
print LIBTYPES "\n\n#include <postgres.h>\n";
@@ -628,6 +648,7 @@
628648
if(/PRIMARY KEY \((.*)\)/i) {
629649
my $tmpfld=$1;
630650
$tmpfld=~s/,/","/g if $dq;
651+
$tmpfld=~s/ //g;
631652
s/PRIMARY KEY (\(.*\))/PRIMARY KEY \($dq$tmpfld$dq\)/i;
632653
s/(PRIMARY KEY \(.*\)).*/$1$check\n/i;
633654
}
@@ -704,7 +725,7 @@
704725

705726
open(MAKE,">Makefile");
706727
print MAKE "#
707-
# My2Pg \$Revision: 1.7 $ \translated dump
728+
# My2Pg \$Revision: 1.8 $ \translated dump
708729
# Makefile
709730
#
710731

0 commit comments

Comments
 (0)