Questions tagged [perl]
34 questions
6
votes
1 answer
How can I create and initialize a schema for a embedded MySQL DB?
I want to create an embedded MySQL database for running tests, but I'm not sure how to do it.
How do I initialize the database?
How do I run my create table statements?
I'm using Perl, so it needs to be done with a language and not a couple of…
xenoterracide
- 2,921
- 5
- 31
- 33
5
votes
1 answer
PostgreSQL pl/perl trigger, differentiate null vs empty
I've been trying to speed up a generic auditing trigger that I had written in pl/pgsql some time back. On update, it generates a list of columns in the table being updated and inserts rows in the auditing table recording any changes (by table,…
Jafoy
- 83
- 7
5
votes
2 answers
Kill infinite loop plperl
How can I kill session with infinite looped plperl function?
Both pg_terminate_backend and pg_cancel_backend had no effect. kill -1 pid did nothing as well and kill -9 pid crashed server.
Łukasz Kamiński
- 173
- 5
5
votes
1 answer
How to create an alphanumeric sequence like AAAA0000 and so on
I want to create an alphanumeric sequence like this:
AAAA0000
AAAA0001
AAAA0002
AAAA0003
.
.
.
AAAA9999
AAAB0000
AAAB0001
.
.
.
ZZZZ9999
I have created this store procedure to do that but its too slow:
CREATE OR REPLACE FUNCTION…
juanpscotto
- 163
- 2
- 5
4
votes
1 answer
Where temp table data goes after creation?
As far as I can understand temp_buffers setting serve for storing temp tables data.
But as I have created a temp table immediately files gets created for it inside PGDATA along with the main database.
So I would appreciate help on several…
George K
- 2,306
- 1
- 17
- 32
3
votes
2 answers
How can I load 'utf8' into plperl by default?
I am attempting to solve a problem explained in another question here. On Debian 7.4 with Postgres 9.1.12, I am able to use the Perl qr operator just fine. On Solaris 5.11 with Postgres 9.2.4, however, I am not able to.
As detailed in the question…
Flimzy
- 609
- 1
- 5
- 18
3
votes
2 answers
Perl DBI takes 60 seconds to connect to an Oracle database, every single time
I feel like I must be doing something wrong with my SQL connections. I've generally ignored it, but I'm finally going to try and get to the bottom of this.
my $dsn = "DBI:Oracle:host=$host;sid=$sid";
my $dbh = DBI->connect($dsn,$dbuser,$dbpass,{…
ND Geek
- 201
- 2
- 9
3
votes
2 answers
Convert Ruby regex to Postgres regex, for selecting invalid email addresses
I've done some internet trawling, and some reading of the Postgres regex docs, but I'm at the stage where I think asking a question here is the best thing to do.
I have the following Ruby regex:
/\A[^@\s]+@([^@\s]+\.)+[^@\W]+\z/
Which I am trying…
samjewell
- 131
- 4
3
votes
2 answers
Installing a language with Amazon RDS?
I am using an instance of Postgres on RDS and I am trying to run:
=> create language plperlu;
but I get:
ERROR: must be superuser to create procedural language "plperlu"
If I run:
=> grant rds_superuser to treex;
NOTICE: role "treex" is already a…
Randomize
- 1,203
- 2
- 21
- 36
2
votes
1 answer
DBD::mysql complains "Character set 'latin1' is not a compiled character set"
I think this boils down to "Am I doomed to upgrading mysql hoping the problem goes away?". I've seen a few of the same issues around the internet but with no guidance on a fix other than "Did you turn it off and on again?"
I've install Perl's…
brian d foy
- 121
- 5
2
votes
1 answer
Character Encoding in Postgres
I have UTF8 data stored in Postgres. I can query it with a Perl script and display it properly. When I use the Postgres client, it displays like the encoding is off. I'll see characters displayed like \u0087\u0081.
From inside the database:
=>…
thatguy
- 21
- 1
- 3
2
votes
2 answers
Limit WHERE to MAX() & COUNT()
This is my current mySQL query:
SELECT e.*, MAX(m.datetime) AS unread_last, COUNT(m.id) AS unread
FROM TAB_EVENT e
LEFT JOIN TAB_MESSAGE m ON e.id=m.event_id
WHERE ( m.`read` IS NULL OR m.`read` = 0)
GROUP BY e.id
ORDER BY m.datetime DESC,…
Sebastian
- 217
- 1
- 3
- 7
2
votes
1 answer
pt-table-sync fails "Turning off AutoCommit"
While trying to use pt-table-sync with the following options for a list of slaves:
pt-table-sync --print --replicate schema.checksum_table --sync-to-master slave-001
I receive the following error message on some of the slaves:
DBD::mysql::db STORE…
Ana C.
- 83
- 9
1
vote
2 answers
Perl - MySQL/MariaDB - slow with no identifiable bottleneck
I am running a Perl script (using DBI) which reads from raw files from a hard disk, and updates MySQL database (which is on a separate SSD). My performance is rather slow (1000 files processed in 30-60 seconds), but I can not find the…
Shalabajzer
- 31
- 4
1
vote
1 answer
How to generate current Oracle timestamp in perl?
I use DBI. And I want to make some like
INSERT INTO ... VALUES (the_generated_timestamp, ...);
What is the command? How could it be created, the perl ocaltime scalar value has a very complex, for human eyes optimized format (f.e. Mon Apr 28…
peterh
- 2,137
- 8
- 28
- 41