|
35 | 35 | # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
36 | 36 | # SUCH DAMAGE.
|
37 | 37 | #
|
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 $ |
40 | 40 |
|
41 | 41 | # TODO:
|
42 | 42 | # + Handle SETs
|
|
47 | 47 |
|
48 | 48 | #
|
49 | 49 | # $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. |
52 | 72 | #
|
53 | 73 | # Revision 1.23 2002/02/07 22:13:52 fonin
|
54 | 74 | # Bugfix by Hans-Juergen Schoenig <hs@cybertec.at>: additional space after
|
|
151 | 171 | $|=1;
|
152 | 172 |
|
153 | 173 | print("------------------------------------------------------------------");
|
154 |
| -print("\n-- My2Pg 1.23 translated dump"); |
| 174 | +print("\n-- My2Pg 1.24 translated dump"); |
155 | 175 | print("\n--");
|
156 | 176 | print("\n------------------------------------------------------------------");
|
157 | 177 |
|
|
173 | 193 | # push header to libtypes.c
|
174 | 194 | open(LIBTYPES,">$libtypesource");
|
175 | 195 | print LIBTYPES"/******************************************************";
|
176 |
| -print LIBTYPES"\n * My2Pg\$Revision: 1.7 $\translated dump"; |
| 196 | +print LIBTYPES"\n * My2Pg\$Revision: 1.8 $\translated dump"; |
177 | 197 | print LIBTYPES"\n * User types definitions";
|
178 | 198 | print LIBTYPES"\n ******************************************************/";
|
179 | 199 | print LIBTYPES"\n\n#include <postgres.h>\n";
|
|
628 | 648 | if(/PRIMARY KEY\((.*)\)/i) {
|
629 | 649 | my$tmpfld=$1;
|
630 | 650 | $tmpfld=~s/,/","/gif$dq;
|
| 651 | +$tmpfld=~s///g; |
631 | 652 | s/PRIMARY KEY (\(.*\))/PRIMARY KEY\($dq$tmpfld$dq\)/i;
|
632 | 653 | s/(PRIMARY KEY\(.*\)).*/$1$check\n/i;
|
633 | 654 | }
|
|
704 | 725 |
|
705 | 726 | open(MAKE,">Makefile");
|
706 | 727 | print MAKE"#
|
707 |
| -# My2Pg\$Revision: 1.7 $\translated dump |
| 728 | +# My2Pg\$Revision: 1.8 $\translated dump |
708 | 729 | # Makefile
|
709 | 730 | #
|
710 | 731 |
|
|