pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedPerl::DBI and TYPE of column
5+ messages / 4 participants
[nested] [flat]
* Perl::DBI and TYPE of column
@ 2020-03-03 14:02 Matthias Apitz <guru@unixarea.de>
2020-03-03 14:36 ` Re: Perl::DBI and TYPE of column Tom Lane <tgl@sss.pgh.pa.us>
2020-03-03 16:09 ` Re: Perl::DBI and TYPE of column Adrian Klaver <adrian.klaver@aklaver.com>
2020-03-03 16:23 ` Re: Perl::DBI and TYPE of column Christoph Moench-Tegeder <cmt@burggraben.net>
0 siblings, 3 replies; 5+ messages in thread
From: Matthias Apitz @ 2020-03-03 14:02 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
Hello,
We unload Sybase and Oracle data to migrate the database to PostgreSQL.
The loading is done very fast with PostgreSQL's COPY command.
During unload trailing blanks in all columns are discarded, because they
would cause problems during loading for INT and DATE columns. The
discarding is done like this after fetching the row into the array
@row_ary:
...
# SRP-25024: support for PostgreSQL: we remove on export trailing blanks
foreach my $i (0..$#row_ary) {
$row_ary[$i] =~ s/\s+$//;
# but for CHAR columns we keep one
# print $dba->{'sth'}->{NAME}->[$i] . " " . $dba->{'sth'}->{TYPE}->[$i] . "\n";
# it seems that VARCHAR in Sybase is TYPE=1 and in Oracle TYPE=12
# see also http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc36273.1570/html/sprocs/CI...
# and ftp://sqlstandards.org/SC32/SQL_Registry/
#
if ($dba->{'sth'}->{TYPE}->[$i] == 1 || $dba->{'sth'}->{TYPE}->[$i] == 12) {
$row_ary[$i] =~ s/^$/ /;
}
}
My question here is: How I could get a copy of the document
ftp://sqlstandards.org/SC32/SQL_Registry/
Any copy available here in this list? Thanks
matthias
--
Matthias Apitz, ✉ guru@unixarea.de, http://www.unixarea.de/ +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Perl::DBI and TYPE of column
2020-03-03 14:02 Perl::DBI and TYPE of column Matthias Apitz <guru@unixarea.de>
@ 2020-03-03 14:36 ` Tom Lane <tgl@sss.pgh.pa.us>
2020-03-03 14:51 ` Re: Perl::DBI and TYPE of column Matthias Apitz <guru@unixarea.de>
2 siblings, 1 reply; 5+ messages in thread
From: Tom Lane @ 2020-03-03 14:36 UTC (permalink / raw)
To: Matthias Apitz <guru@unixarea.de>; +Cc: pgsql-general@lists.postgresql.org
Matthias Apitz <guru@unixarea.de> writes:
> During unload trailing blanks in all columns are discarded, because they
> would cause problems during loading for INT and DATE columns.
Really?
regression=# select '123 '::int;
int4
------
123
(1 row)
regression=# select '12-02-2019 '::date;
date
------------
2019-12-02
(1 row)
regards, tom lane
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Perl::DBI and TYPE of column
2020-03-03 14:02 Perl::DBI and TYPE of column Matthias Apitz <guru@unixarea.de>
2020-03-03 14:36 ` Re: Perl::DBI and TYPE of column Tom Lane <tgl@sss.pgh.pa.us>
@ 2020-03-03 14:51 ` Matthias Apitz <guru@unixarea.de>
0 siblings, 0 replies; 5+ messages in thread
From: Matthias Apitz @ 2020-03-03 14:51 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-general@lists.postgresql.org
El día Dienstag, März 03, 2020 a las 09:36:32 -0500, Tom Lane escribió:
> Matthias Apitz <guru@unixarea.de> writes:
> > During unload trailing blanks in all columns are discarded, because they
> > would cause problems during loading for INT and DATE columns.
>
> Really?
>
> regression=# select '123 '::int;
> int4
> ------
> 123
> (1 row)
>
> regression=# select '12-02-2019 '::date;
> date
> ------------
> 2019-12-02
> (1 row)
The problem occurs when loading CSV data like ...| |... into an INT
column with COPY. I could make you an exact example.
But this wasn't my question, my question is where the document is.
matthias
--
Matthias Apitz, ✉ guru@unixarea.de, http://www.unixarea.de/ +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Perl::DBI and TYPE of column
2020-03-03 14:02 Perl::DBI and TYPE of column Matthias Apitz <guru@unixarea.de>
@ 2020-03-03 16:09 ` Adrian Klaver <adrian.klaver@aklaver.com>
2 siblings, 0 replies; 5+ messages in thread
From: Adrian Klaver @ 2020-03-03 16:09 UTC (permalink / raw)
To: Matthias Apitz <guru@unixarea.de>; pgsql-general@lists.postgresql.org
On 3/3/20 6:02 AM, Matthias Apitz wrote:
> Hello,
>
> We unload Sybase and Oracle data to migrate the database to PostgreSQL.
> The loading is done very fast with PostgreSQL's COPY command.
>
> During unload trailing blanks in all columns are discarded, because they
> would cause problems during loading for INT and DATE columns. The
> discarding is done like this after fetching the row into the array
> @row_ary:
>
> ...
> # SRP-25024: support for PostgreSQL: we remove on export trailing blanks
> foreach my $i (0..$#row_ary) {
> $row_ary[$i] =~ s/\s+$//;
> # but for CHAR columns we keep one
> # print $dba->{'sth'}->{NAME}->[$i] . " " . $dba->{'sth'}->{TYPE}->[$i] . "\n";
> # it seems that VARCHAR in Sybase is TYPE=1 and in Oracle TYPE=12
> # see also http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc36273.1570/html/sprocs/CI...
> # and ftp://sqlstandards.org/SC32/SQL_Registry/
> #
> if ($dba->{'sth'}->{TYPE}->[$i] == 1 || $dba->{'sth'}->{TYPE}->[$i] == 12) {
> $row_ary[$i] =~ s/^$/ /;
> }
> }
>
> My question here is: How I could get a copy of the document
> ftp://sqlstandards.org/SC32/SQL_Registry/
>
> Any copy available here in this list? Thanks
All I could find:
https://grokbase.com/t/perl/dbi-users/074q99ddsn/registry-of-values-for-ansi-x3-135-and-iso-iec-9075...
>
> matthias
>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Perl::DBI and TYPE of column
2020-03-03 14:02 Perl::DBI and TYPE of column Matthias Apitz <guru@unixarea.de>
@ 2020-03-03 16:23 ` Christoph Moench-Tegeder <cmt@burggraben.net>
2 siblings, 0 replies; 5+ messages in thread
From: Christoph Moench-Tegeder @ 2020-03-03 16:23 UTC (permalink / raw)
To: Matthias Apitz <guru@unixarea.de>; +Cc: pgsql-general@lists.postgresql.org
## Matthias Apitz (guru@unixarea.de):
> My question here is: How I could get a copy of the document
> ftp://sqlstandards.org/SC32/SQL_Registry/
Methinks that the most interesting constants of that are already in
DBI (export tag sql_types) - man DBI, /sql_types. Is that the data
you're looking for? Also look at DBD::Pg, pg_types.
Regards,
Christoph
--
Spare Space
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2020-03-03 16:23 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-03-03 14:02 Perl::DBI and TYPE of column Matthias Apitz <guru@unixarea.de>
2020-03-03 14:36 ` Tom Lane <tgl@sss.pgh.pa.us>
2020-03-03 14:51 ` Matthias Apitz <guru@unixarea.de>
2020-03-03 16:09 ` Adrian Klaver <adrian.klaver@aklaver.com>
2020-03-03 16:23 ` Christoph Moench-Tegeder <cmt@burggraben.net>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox