Re: [GENERAL] An amusing MySQL weakness--not!

2011-06-25 Thread Randal L. Schwartz
 Michael == Michael Nolan htf...@gmail.com writes:

Michael Earlier today I was working on a MySQL database (not by choice, I 
assure
Michael you),

Friends don't let friends use MySQL.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.posterous.com/ for Smalltalk discussion

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] NoSQL -vs- SQL

2010-10-12 Thread Randal L. Schwartz
 Carlos == Carlos Mennens carlos.menn...@gmail.com writes:

Carlos Looking to read your feedback and / or opinions.

Here's what I wrote on the Smalltalk Seaside mailing list a few weeks
back:


I've given a talk a few times about forget the ORM.  The slides are up 
on http://www.slideshare.net/RandalSchwartz/forget-the-orm

The key thing that separates a lot of these newer databases is that you 
can't have all three of consistency, availability, and performance at 
once... you have to sacrifice something.  Traditional SQL databases 
favored consistency over everything, but who cares if your blog page 
says read the 6 comments on this item for a couple of seconds when 
there are really 7 because one just got added. 

The new databases give options for higher availability or performance at 
the cost of consistency.  Some, like Riak (interviewed at 
http://twit.tv/floss129), actually let you select on each request how 
consistent you want the results, thus controlling how fast you get the 
response.  Thus, for the front page of a blog, you can say give me a 
result that any 1 of the 3 replicas has, but when you finally drill 
into the comments, you say give me a result that all 3 replicas agree 
on.  Of course, these are all *eventually* consistent on the order of 
tens or hundreds of milliseconds, but by allowing almost correct 
results, things are a lot zippier.  (It also works that way on 
write... you can say come back when any 1 replica says it has it or 
come back only when all 3 replicas confirm write.) 

So, it's not so much that you get schemaless key/value store (although 
that's a frequent feature)... it's that these aren't traditional 
databases in a lot of ways. 


-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.posterous.com/ for Smalltalk discussion

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Merge replication with Postgresql on Windows?

2010-09-28 Thread Randal L. Schwartz
 novnovice == novnovice  novnov...@gmail.com writes:

novnovice That's a surprising response. But it makes sense, at least as
novnovice one perspective. I have written light duty sync systems but
novnovice figured that there would be some battle tested postgresql
novnovice solution that was more robust than I could cobble
novnovice together. As in, if I invest 40 hours learning replication
novnovice system X, I'd be further along than if I'd invested the same
novnovice 40 hours writing my own system from scratch. It's not simple
novnovice stuff. It would still be good to eval whatever canned
novnovice solutions are out there. I have googled this topic of course;
novnovice among the candidates none seemed to be a great match up with
novnovice what I hoped to find.

CouchDB is open source, and was designed with this sort of disconnected
syncing in mind.  You can hear my interview with Jan Lehnardt at
http://twit.tv/floss36.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Simple schema diff script in Perl

2010-09-16 Thread Randal L. Schwartz
 hans == hans  h...@welinux.cl writes:

hans Actually just compare tables and fields, for my current
hans requirements is ok, i plan to add the sequences, but no more.

I believe SQLFairy (aka SQL::Translator) can canonicalize schemas, and
even give DDL to turn one schema into another.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] MySQL versus Postgres

2010-08-09 Thread Randal L. Schwartz
 Joshua == Joshua J Kugler jos...@eeinternet.com writes:

Joshua I'll add in a me too only to say that I am someone that learns
Joshua best by example.

Keep in mind though that there are three primary learning modes:
- example
- concept
- structure

Do not overemphasize the example mode at the cost of presenting concepts
or structure.  You need all three.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Email address column verification foraddress list

2010-04-13 Thread Randal L. Schwartz
 Andrus == Andrus  kobrule...@hot.ee writes:

Andrus This is existing database deployed to many sites and used by many 
programs.
Andrus Re-factoring db and software to add this minor feature seems to be not
Andrus reasonable. For 99% of cases field contains only single address.

So for most applications written against this database, they're probably
assuming only one email address in this column.

And then you confuse the issue by putting two or more comma-separated
addresses, which are not universally usable when a single address
is provided.

I sense this code will end up on thedailywtf.com[1] when you leave
and your successor discovers what you insanely tried to do.

[1] which should be mandatory reading for *all* devs, with the goal
of never let my code end up here

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Clarification regarding array columns usage?

2009-12-25 Thread Randal L. Schwartz
 m == m hvostinski makhv...@gmail.com writes:

m I would appreciate if someone could clarify the aspects of using array
m columns.

In general, bad idea.

m We need to store up to ten related integer values per row and currently it
m is implemented as a varchar column that holds a string that is concatenated
m by a trigger function. Something like this:

Why?

If you were storing these as a daughter table, then you get
easy parsing, easy concurrent updating, easy access to aggregate
functions.  Just like SQL was meant to be used.

Stop thinking of tables as Excel sheets.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] What's wrong with this regexp?

2009-10-10 Thread Randal L. Schwartz
 Nick == Nick  nboutel...@gmail.com writes:

Nick SELECT TRUE WHERE '/steps/?step=10' ~ '^\/steps\/\?step=10$'

Here's the first clue:

merlyn=# select '^\/steps\/\?step=10$';
WARNING:  nonstandard use of escape in a string literal
LINE 1: select '^\/steps\/\?step=10$';
   ^
HINT:  Use the escape string syntax for escapes, e.g., E'\r\n'.
 ?column?  
---
 ^/steps/?step=10$
(1 row)

Notice the \'s just disappeared, so it's not gonna have much good
for the ?, which will be interpreted as the optional suffix.

Even adding 'E' (from the hint) isn't quite enough:

merlyn=# select E'^\/steps\/\?step=10$';
 ?column?  
---
 ^/steps/?step=10$
(1 row)

We need the resulting value to have \? in it, and that's not
there yet.  So, that's the clue.  Don't need \/, but do need \\?, so
it looks like this:

merlyn=# select E'^/steps/\\?step=10$';
  ?column?  

 ^/steps/\?step=10$
(1 row)

Aha, and now we have the right string for the regex engine, so
let's test that match:

merlyn=# select '/steps/?step=10' ~ E'^/steps/\\?step=10$';
 ?column? 
--
 t
(1 row)

Bingo.  True.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Postgre RAISE NOTICE and PHP

2009-08-19 Thread Randal L. Schwartz
 Clemens == Clemens Schwaighofer clemens_schwaigho...@e-gra.co.jp 
 writes:

Clemens Just in my opinion, this regex is completely too large. For basic
Clemens validating something like:
Clemens 
^[A-Za-z0-9!#$%'*+-\/=?^_`{|}~][A-Za-z0-9!#$%'*+-\/=?^_`{|}~\.]{0,6...@[a-za-z0-9-]+(\.[a-zA-Z0-9-]{1,})*\.([a-zA-Z]{2,4}){1}$
Clemens works very well

Fails on .mobile TLD.  Has a pointless {1} in it, which does
absolutely nothing, providing that the creator of the regex was already
missing a few clues.

That's the problem with these kinds of regex... you test it on what
you know, but you're not consulting the *actual* *internet* specifications
(which have been readily available since the dawn of Internet time).

Either use the regex I pointed to already, or stay with the simpler:

  /\...@.*\s/

which will at least not deny anyone with a *perfectly legitimate* email
address from making it into your system.

Or, use your regex *only* in an *advice* category, with the ability
for the user to say yes, I'm really sure this is my address.

Please, for the sake of the net, do the Right Thing here.  This is
what I'm arguing for.  Anything less than that, and your code deserves
to end up in thedailywtf.com as an example of what *not* to do.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Postgre RAISE NOTICE and PHP

2009-08-19 Thread Randal L. Schwartz
 Clemens == Clemens Schwaighofer clemens_schwaigho...@e-gra.co.jp 
 writes:

Clemens I am not going to defend any regex here, but in my opinion it helps on
Clemens what I want to see in email addresses.
Clemens Yes it fails on mobile, but I have not yet seen one.

And that's the problem.  You get near-sighted if you put up a strong
validation for only things that *you* have seen.  Because, guess what,
nobody outside your narrow view can sign up or be a customer.

Bad for business.

Clemens  Probably the best
Clemens thing is to test nothing at all. Just accept it ...

Exactly!  If you don't want to use the 950-character regex, DON'T DO
ANYTHING AT ALL.  Far simpler.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Postgre RAISE NOTICE and PHP

2009-08-18 Thread Randal L. Schwartz
 Andre == Andre Lopes lopes80an...@gmail.com writes:

Andre I'm developing a function with some checks, for example... to check if 
the
Andre e-mail is valid or not.

How are you hoping to do this?  The regex to validate an email
address syntactically is pretty large:

  http://ex-parrot.com/~pdw/Mail-RFC822-Address.html

And no, I'm not kidding.  If your regex is smaller than that, you aren't
validating email... you're validating something kinda like email.

For example, fredbar...@stonehenge.com is a valid email address.  (Go
ahead, try it... it has an autoresponder.)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] pgsql and Mac OS X

2007-04-30 Thread Randal L. Schwartz
 Tom == Tom Allison [EMAIL PROTECTED] writes:

Tom /System/Library/CoreServices/RemoteManagement/rmdb.bundle/bin/psql

That's not on my mac.  Must be some bolt-on you installed.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faq


Re: [GENERAL] pgsql and Mac OS X

2007-04-30 Thread Randal L. Schwartz
 Tom == Tom Lane [EMAIL PROTECTED] writes:

Tom What you can do if you want to build PG from source is build normally
Tom but only install the client programs.  The Fine Manual recommends

Tom  gmake -C src/bin install
Tom  gmake -C src/include install
Tom  gmake -C src/interfaces install
Tom  gmake -C doc install

Tom instead of the usual gmake install.

The Randal Notebook recommends:

  fink install postgresql

:-)

Then you get automatic startup on boot, usernames added, etc.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

---(end of broadcast)---
TIP 6: explain analyze is your friend


Re: [GENERAL] cutting out the middleperl

2007-03-27 Thread Randal L. Schwartz
 Kenneth == Kenneth Downs [EMAIL PROTECTED] writes:

Kenneth This in effect makes the web server a proxy to the database, which
Kenneth sounds like what you are after.  The P portion for us is PHP, not
Kenneth Perl, and it is small though non-zero.  It has only two jobs really.
Kenneth In the one direction it converts HTTP requests into SQL, and in the
Kenneth other it converts SQL results into HTML.

How do you control trust?  I presume you're not accepting raw SQL queries (or
even snippets) over the wire, so you have to have enough server-side mapping
code to map domain objects into database objects and domain verbs into
queries, and then authenticate and authorize that this verb is permitted by
the incoming user. That can't be just a trivial amount of code.  That's
usually a serious pile of code.

And please don't tell me you do all of that client-side. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
merlyn@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

---(end of broadcast)---
TIP 6: explain analyze is your friend


Re: [GENERAL] exception handling in plperlu

2007-03-16 Thread Randal L. Schwartz
 Douglas == Douglas McNaught [EMAIL PROTECTED] writes:

Douglas my $dbh;

Douglas eval { $dbh = connect(...) };

Since eval returns its value (or undef if $@ has the error), you can shorten
this to:

my $dbh = eval { DBI-connect(...) };

and now either look at $@ (if you want to distinguish exception vs normal) or
just defined $dbh (if you want to know if you have a useful handle or not).

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
merlyn@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings


Re: [GENERAL] postgresql vs mysql

2007-02-22 Thread Randal L. Schwartz
 Russ == Russ Brown [EMAIL PROTECTED] writes:

Russ Take perl for example. I have still yet to see readable Perl code.

I could say the same for greek, and pl/pgsql.

You can't read it if you're not familiar with it.  Please stop bashing Perl
until you've read at least Learning Perl or the equivalent.  Please.  You have
no right.  It's pure prejudice, and usually just parroted from others.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
merlyn@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

---(end of broadcast)---
TIP 4: Have you searched our list archives?

   http://archives.postgresql.org/


Re: [GENERAL] php professional

2007-02-22 Thread Randal L. Schwartz
 Mark == Mark Walker [EMAIL PROTECTED] writes:

Mark Similar issues with Mysql.  It's faster,

But it doesn't matter *how* fast you get the *wrong* answer. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
merlyn@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your desire to
   choose an index scan if your joining column's datatypes do not
   match


Re: [GENERAL] Postgresql 8.1: plperl code works with LATIN1, fail

2007-01-29 Thread Randal L. Schwartz
 Michael == Michael Fuhr [EMAIL PROTECTED] writes:

Michael Isn't that the situation here?  The PL/Perl function body is a
Michael string encoded in the database's encoding, which in this case is
Michael UTF-8.

If that's always the case, then the embedded Perl interpreter should
be started in that mode, perhaps by adding -Mutf8 to the arg list
of the embedded interpreter.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
merlyn@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings


Re: [GENERAL] More grist for the PostgreSQL vs MySQL mill

2007-01-20 Thread Randal L. Schwartz
 John == John Meyer [EMAIL PROTECTED] writes:

John I'd say fine, but why discuss the flaws of MySQL on a PostgreSQL list?
John If you want to correct it, why not put that flaw on a MySQL list.  And
John yes, I agree, there is a difference between pointing out a legitimate
John flaw and simply bashing for bashing's sake.

It's a valid discussion here (although better on -advocacy), because it helps
me have the right facts to present to clients about whether they should stay
with a legacy database in MySQL vs upgrading to a modern PostgreSQL.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
merlyn@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

---(end of broadcast)---
TIP 4: Have you searched our list archives?

   http://archives.postgresql.org/


Re: [GENERAL] cpan perl module - plperlu danger?

2006-06-22 Thread Randal L. Schwartz
 A == A M [EMAIL PROTECTED] writes:

A  [But even Safe.pm has had
A dozens of bugs revealed over the years- caveat emptor.]

Eeeh?  Proof please? That's just FUD-raking.

From what I recall, there have been a few clever leakages that have been fixed
rather rapidly.

few ne dozens.

The main problem with Safe is that it's at the wrong granularity (per opcode,
not per semantic operation).

But let's not be throwing the baby out with the bathwater... Safe is 99.97% of
the way there.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
merlyn@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

---(end of broadcast)---
TIP 6: explain analyze is your friend


Re: [GENERAL] Oracle purchases Sleepycat - is this the other shoe for MySQL AB?

2006-02-15 Thread Randal L. Schwartz
 Tom == Tom Lane [EMAIL PROTECTED] writes:

Tom* Change to use no page locks for table scanning operations. 
Tom Maybe I'm misunderstanding, but that sure sounds like they intend to
Tom dumb down BDB so that it no longer works well in concurrent situations,
Tom in order to save a few cycles in single-user scenarios.  Have MySQL
Tom officially abandoned the multi-user case to us?

What they lose in usability, they gain back in benchmarks, and that's
all that matters: getting the wrong answer really fast.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
merlyn@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

---(end of broadcast)---
TIP 4: Have you searched our list archives?

   http://archives.postgresql.org


[GENERAL] Oracle purchases Sleepycat - is this the other shoe for MySQL AB?

2006-02-14 Thread Randal L. Schwartz

Oracle purchases Sleepycat.  From what I understand, BerkeleyDB was the
other way that MySQL could have transactions if Oracle decided to
restrict InnoDB tables (after purchasing Innobase last year).

Does this mean the other shoe has dropped for MySQL AB?

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
merlyn@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster


Re: [GENERAL] Adding columns to a view

2005-12-28 Thread Randal L. Schwartz
 Ingo == Ingo van Lil [EMAIL PROTECTED] writes:

Ingo Well, in my case the situation is further complicated by the fact that
Ingo adding a column to the view should be done automatically from a trigger
Ingo function. I wanted some kind of matrix view that had a column for every
Ingo row in a certain table. And whenever a new line was inserted into that
Ingo table the view should automatically be extended by one column.

This seems wrong, with the same spidey sense tingling that triggered (ugh :)
yesterday when I said sending mail from the database is wrong.

Your tables shouldn't change during the execution of your application.
If they must, you are probably pushing things that belong above SQL
(like middleware) and forcing SQL to do them, with all the appropriate
trouble that results from that.

In general, if it looks difficult to do with PostgreSQL, you're
probably heading the wrong direction for good database design.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
merlyn@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

---(end of broadcast)---
TIP 6: explain analyze is your friend


Re: [GENERAL] sending mail from Postgres

2005-12-28 Thread Randal L. Schwartz
 Ted == Ted Byers [EMAIL PROTECTED] writes:

Ted Here is a general question relating to this.  The problem involves due
Ted diligence related to environmental protection.  Consider a distributed
Ted application to support this.  You have a facility with an
Ted environmental monitoring program.  Samples are taken from soil, water
Ted and air and sent off-site for analysis.  Each sample, when analyzed,
Ted results in a report sent to the facility's management for their
Ted records.  However, if the concentration of some contaminant in a
Ted sample is above some threshold, a second report, containing the
Ted complete analysis results for the sample, is generated and sent to one
Ted or more people, both inside and outside the organisation
Ted (e.g. engineers within the organization responsible for fixing
Ted problems with the facility and engineers at relevant regulatory
Ted agencies). One objective is to automate as much of the data management
Ted as possible and to ensure that if a problem arises everyone who needs
Ted to know about it is notified.  The process has to be auditable, so
Ted that information about when each step in the process starts is stored
Ted in the database, as well as information about when messages are
Ted acknowledged (again automated - so when an engineer opens a message
Ted about a problem, an acknowledgement is sent to the database without
Ted his intervention).

Ted I suppose email might work as a means of sending messages, but I was
Ted thinking of Sun's JMS instead, working with triggers.  I could then
Ted create my own thin client to display the reports, perhaps sorting them
Ted according to user specified criteria.  I can see how to do it within
Ted the web tier, or within the client tier (within the labs doing the
Ted analyses).  The thing is, of the designs I have considered, the one
Ted involving triggers with JMS on the main supporting website (with a
Ted database back end) is the simplest in terms of deployment, since all
Ted interested parties could interact with the application through the
Ted internet using a very thin client (perhaps even with an applet within
Ted a web page) and I would not need to worry about deploying software to
Ted all relevant people/sites.

Ted If you faced this problem, what would you do, and why?

As already proposed, I'd have a trigger noticing the exceptional
condition post a record to an audit log table (and use NOTIFY).  Then
I'd have a notification process manage watching that table, and send
the notices as needed.

That's the right level for this.  Database triggers should be about
adding rows, deleting rows, and modifying values in rows to manage
integrity.  It's the middleware that's responsible for repackaging
that or acting on changed data.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
merlyn@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

---(end of broadcast)---
TIP 4: Have you searched our list archives?

   http://archives.postgresql.org


Re: [GENERAL] sending mail from Postgres

2005-12-27 Thread Randal L. Schwartz
 Tony == Tony Caduto [EMAIL PROTECTED] writes:

Tony Check out my site at http://www.amsoftwaredesign.com

Tony and click on the forums link, I have some examples on how to send a
Tony email from a function using plperl, also how to connect to a simple
Tony socket server and send messages, plus lots of other function examples,
Tony some my own and some from the original function cookbook.

I fear for the future.

Did someone forget what a database is for?

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
merlyn@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly


Re: [GENERAL] Wikipedia help requested, especially non-English speakers

2005-11-12 Thread Randal L. Schwartz
 Greg == Greg Sabino Mullane [EMAIL PROTECTED] writes:

Greg It's better if you actually create an account. Not only will it make
Greg talking about the page easier, you can add the page (and others)
Greg to your watchlist to monitor vandalism.

And, some Wikipedians uses un-logged-in edits as a high indicator that
the work is vandalism, and get prepared to revert.  It's odd... being
logged in gives you *more* anonymity, not less. :) But the vandals
don't understand that... yet.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
merlyn@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster


Re: [GENERAL] Beyond the 1600 columns limit on windows

2005-11-08 Thread Randal L. Schwartz
 Evandro's == Evandro's mailing lists (Please, don't send personal 
 messages to this address) [EMAIL PROTECTED] writes:

[I would have replied to your personal address, but I'm not about
to copy it from a footer.]

Evandro's I'm doing a PhD in data mining and I need more than 1600 columns. I 
got an
Evandro's error message saying that I can not use more than 1600 columns.
Evandro's  It is happening because I have to change categorical values to 
binary
Evandro's creating new columns. Do you know if oracle can handle it?

/me boggles

You are doing a PhD in data mining, and you have a table that needs
more than 1600 columns?

/me gasps

What are they *teaching* these days?

If you have a design that has more than 20 or so columns, you're
probably already not normalizing properly.  There just aren't *that*
many attributes of a object before you should start factoring parts of
it out, even if it means creating some 1-1 tables.

In programming, if I ever see someone name a sequence of variables,
like thing1 and thing2, I know there's going to be trouble ahead,
because that should have been a different data structure.  Similarly,
I bet some of your columns are foo1 and foo2.  Signs of brokenness
in the design.

Or do you really have 1600 *different* attributes, none of which have
a number in their name?  That requires a serious amount of
creativity. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
merlyn@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your desire to
   choose an index scan if your joining column's datatypes do not
   match


Re: [GENERAL] Perl regular expressions

2005-09-29 Thread Randal L. Schwartz
 Scott == Scott Marlowe [EMAIL PROTECTED] writes:

Scott And you can use perl regex in PHP as well, since it supports the PCRE
Scott lib.

Well, *almost* Perl.  Despite its name, PCRE is a misnomer, since it's
not really Perl and it's not entirely compatible. :) Yes, it's a
powerful regular expression engine, but Perl regexen can still do some
common things that cannot be done with PCRE.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
merlyn@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings


Re: [GENERAL] Email Verfication Regular Expression

2005-09-08 Thread Randal L. Schwartz
 Cristian == Cristian Prieto [EMAIL PROTECTED] writes:

Cristian  res = res_query(name, C_IN, T_MX, answer, sizeof(answer));

This incorrectly fails if an address has an A record but no MX
record.  According to RFC 2821 Section 5:

   The lookup first attempts to locate an MX record associated with
   the name.  If a CNAME record is found instead, the resulting name
   is processed as if it were the initial name.  If no MX records are
   found, but an A RR is found, the A RR is treated as if it was
   associated with an implicit MX RR, with a preference of 0, pointing
   to that host.

So, your function will say no good if the domain has an A record but
no MX record, even though the RFC says that's OK and deliverable.

Man, is there a lot of bogus knowledge and cargo culting around this
subject!

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
merlyn@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings


Re: [GENERAL] Email Verfication Regular Expression

2005-09-07 Thread Randal L. Schwartz
 Markus == Markus Rebbert [EMAIL PROTECTED] writes:

Markus Am Mittwoch, den 07.09.2005, 11:17 -0400 schrieb Brad Nicholson:
 Does anybody have regular expression handy to verfiy email addresses?

Markus 
^([a-zA-Z0-9._-]+)\@(([a-zA-Z0-9-]+[.]?){1,}[a-zA-Z0-9-]*+\.){1,}[a-zA-Z]{2,4}$

Markus but i don't think, it's really complete.

Absolutely not.  It rejects fred[EMAIL PROTECTED] which is a perfectly
valid email address.  (Try it, you'll get my autoresponder.)

Google for RFC 822 and RFC 2822 to see the *real* rules.  An
actual regex for an email address is rather large.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
merlyn@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

---(end of broadcast)---
TIP 4: Have you searched our list archives?

   http://archives.postgresql.org


Re: [GENERAL] Email Verfication Regular Expression

2005-09-07 Thread Randal L. Schwartz
 Steve == Steve Atkins [EMAIL PROTECTED] writes:

Steve But, depending on what you're doing, validation may not be a good
Steve idea. There are email addresses that are syntactically invalid that
Steve are deliverable and in active use.

Really?  Name one. Or maybe it's just your idea of syntax that's wrong.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
merlyn@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

---(end of broadcast)---
TIP 4: Have you searched our list archives?

   http://archives.postgresql.org


Re: [GENERAL] Email Verfication Regular Expression

2005-09-07 Thread Randal L. Schwartz
 Steve == Steve Atkins [EMAIL PROTECTED] writes:

Steve So I consider any use of characters outside that set in a hostname or
Steve domain name to be invalid. Specifically an underscore is not a valid
Steve character, so any use of an underscore in the domain-part of an
Steve address that is supposedly an internet address is syntactically
Steve invalid.

Really?  I actually went round and round at a $client who wanted underscores
in DNS, and I had to tell them We can't change the entire world... you'll
have to rename your hosts.

Do you have an example of an underscore host that is publicly addressable?
I'd like to look up their MX. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
merlyn@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

---(end of broadcast)---
TIP 4: Have you searched our list archives?

   http://archives.postgresql.org


Re: [GENERAL] Poll on your LAPP Preferences

2005-08-09 Thread Randal L. Schwartz
 Google == Google Mike [EMAIL PROTECTED] writes:

Google As a PostgreSQL admin or developer, you may be asked to deploy a Linux
Google Apache PHP PostgreSQL application.

Not me.  I'll be deploying an OpenBSD, Apache, PostgreSQL, Perl server.

o/~ you down with O-A-P-P? (yeah you know me!)
get down with OAPP! (yeah you know me!) o/~

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
merlyn@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly


Re: [GENERAL] To Postgres or not

2005-07-14 Thread Randal L. Schwartz
 Neil == Neil Conway [EMAIL PROTECTED] writes:

Neil Does MySQL with InnoDB not qualify as an ACID-compliant database?

Not when you can store a value that is larger than allowed, and it
is silently truncated to be within range.  no *I* integrity there.

That's regardless of InnoDB or not.

MySQL is a toy compared to PostgreSQL.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
merlyn@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings


Re: [GENERAL] getting the ranks of items

2005-05-04 Thread Randal L. Schwartz
 Harald == Harald Fuchs [EMAIL PROTECTED] writes:

Harald Using a temporary sequence for that would avoid naming conflicts.

 P.S. I'm sure you can wrap it in plperl stored procedure :)

Well, yes.  I was (falsely?) recalling that there was a pure SQL way
to do this though.

And the point of doing it as part of the (sub)query is that I was then
going to do a further join and select on this.

Harald Yes, prepending the ranking column in the application would be
Harald more efficient.  I wonder whether Randall knows Perl? ;-)

If not, I'm sure I could dig up a couple of books to learn it. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
merlyn@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings


[GENERAL] getting the ranks of items

2005-05-03 Thread Randal L. Schwartz

I'm probably asking a FAQ, but a few google searches didn't seem
to point me in the right place.

Is there a simple way with PostgreSQL to assign relative ranks to the
result of a query ORDER BY?  That is, I want to either have a view
that cheaply assigns the ranks, or be able to update a column with the
current ranks (yes, I know this latter version is more prone to
error).

I'm certain there's probably something I can do to laminate an array
value to a query result.  Am I confused?  (Yes!)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
merlyn@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send unregister YourEmailAddressHere to [EMAIL PROTECTED])


Re: [GENERAL] getting the ranks of items

2005-05-03 Thread Randal L. Schwartz
 Matthew == Matthew Terenzio [EMAIL PROTECTED] writes:

Matthew On May 3, 2005, at 8:30 PM, Randal L. Schwartz wrote:

 Is there a simple way with PostgreSQL to assign relative ranks to the
 result of a query ORDER BY?


Matthew What do you mean by ranks?

If I order a query by ascending age, the youngest person gets
rank 1, the second youngest gets rank 2, the third youngest gets rank 3,
and if the fourth and fifth tie, they both get 4, and the next one gets 6.

You know, rank? :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
merlyn@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
  subscribe-nomail command to [EMAIL PROTECTED] so that your
  message can get through to the mailing list cleanly


Re: [GENERAL] what happened to the website?

2005-01-19 Thread Randal L. Schwartz
 Bruno == Bruno Wolff [EMAIL PROTECTED] writes:

Bruno http://en.wikipedia.org/wiki/Slashdot_effect

Except that wikipedia itself is suffering from the Slashdot effect
right now. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
merlyn@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send unregister YourEmailAddressHere to [EMAIL PROTECTED])


Re: [GENERAL] apple uses Postgres for RemoteDesktop 2

2004-08-17 Thread Randal L. Schwartz
 Tom == Tom Lane [EMAIL PROTECTED] writes:

Tom Yikes.  They need to get off of that badly broken PG version, too :-(
Tom 7.3.3 was about the worst choice they could have made in the past
Tom several years ...

At least they make a habit of that.  If I recall correctly, OSX 10.1
and 10.2 froze in a bad beta of Perl 5.6.0 prerelease.  Now it's been
updated to at least a normal release (5.8.1, still a year behind, but
that's life).

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faqs/FAQ.html


Re: [GENERAL] High Reliability without High Availability?

2004-03-22 Thread Randal L. Schwartz
 Al == Al Cohen [EMAIL PROTECTED] writes:

Al Is there a log file that does or could do this?  Or some internal
Al system table that we could use to generate something?

I may be just mis-remembering, but wasn't there an embedded-Perl
solution that connected up as triggers for all your changing items to
either write a log, or use DBI to actually update the second database?

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

---(end of broadcast)---
TIP 6: Have you searched our list archives?

   http://archives.postgresql.org


Re: [GENERAL] Postgress and MYSQL

2004-01-13 Thread Randal L. Schwartz
 Tom == Tom Lane [EMAIL PROTECTED] writes:

Tom Bob Powell [EMAIL PROTECTED] writes:
 I find the recent articles in various trade publications a little
 disturbing due to the lack of PostgrSQL mention.

Tom You are seeing the effects of MySQL AB's large marketing budget;
Tom they have the time and money to cause such articles to appear.
Tom I'm not sure there is much we can do to counter this in the short run.
Tom (I do wonder how quickly they are running through that $19 mil
Tom investment though ...)

My new buzz-meme (pass it along)...

You're still using MySQL... that's so 90's!

:-)

Seriously, the space occupied by MySQL has been encroached by SQLite
from the low end (if you just want SQL access to a data file,
including transactions) and PostgreSQL from the high end (when you
want a full-featured database).  I think they've completely overlapped
at this point (especially when I just discovered yesterday that you
can register Perl callbacks for user-defined functions and aggregates
in DBD::SQLite!), so MySQL really doesn't have much of a win at either
end.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faqs/FAQ.html


Re: [GENERAL] Is my MySQL Gaining ?

2003-12-26 Thread Randal L. Schwartz
 Jan == Jan Wieck [EMAIL PROTECTED] writes:

Jan It seems to concern MySQL now at least. They have changed their minds
Jan on many enterprise features that PostgreSQL has for years. The
Jan strategy of misguiding people like you don't need foreign keys, you
Jan don't need stored procedures, yadda yadda triggers, blah blah
Jan views didn't work forever. So they have to add or propose those
Jan features one by one.

I've noticed a similar strategy in the PHP vs Perl dimension.  PHP
started out being simple and fast and easy to learn by throwing off
all of the complexities of Perl that weren't needed.

Slowly and steadily, lagging about 3 to 10 years behind, PHP has
adding one-by-one all those weird Perl features, but doing a poor
job of integrating them.

So, you can get PHP for 2007 already.  It's called Perl, and it's
probably already installed on your box.

PostgreSQL is where MySQL will be in five years might be a good
catchmeme.  Anyone wanna run with it?

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings


Re: [GENERAL] between

2003-12-26 Thread Randal L. Schwartz
 Martin == Martin Marques [EMAIL PROTECTED] writes:

Martin A link to the URL above in the SELECT page?

Uh, do you also want a link to installing PostgreSQL there too?
After all, you have to install Pg before you can use the SELECT
operator.

It's not any more related to SELECT than it is anything else.  It's a
part of an expression.  Expressions are used many places and described
one place.  That's the nature of documentation.

Maybe I'm sounding grouchy, but at some point, you do the common sense
thing.
-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
  joining column's datatypes do not match


Re: Triggers, Stored Procedures, PHP. was: Re: [GENERAL] PostgreSQL

2003-12-01 Thread Randal L. Schwartz
 Jay == Jay O'Connor [EMAIL PROTECTED] writes:

Jay Python also reads more obviously, in that it doesn't have a lot of
Jay 'default context' ($_) and 'scalar context versus array context' and
Jay cute shortcuts and stuff floating around, which makes it easier to
Jay read, and more importantly easier for teams to read.

It also has some things which are functions, and others which are
methods, with no rhyme or reason except for a historical basis.  And
that's just the beginning.  (Why are tuples read only?  Sorry, cheap
shot.)

Please don't paint Python as nice and regular.  It has nearly as many
odd things to know as Perl does.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faqs/FAQ.html


Re: [GENERAL] Humor me: Postgresql vs. MySql (esp. licensing)

2003-10-08 Thread Randal L. Schwartz
 Shridhar == Shridhar Daithankar [EMAIL PROTECTED] writes:

Shridhar Yeah.. like inserting a biiig number in integer field in a transaction
Shridhar without error and not getting it back after commit.. or accepting
Shridhar '00-00-00 00:00:00' as a valid datetime stamp.. something like that..

Shridhar How much deviation is that from ACID? 180 degrees...:-)

Unverified, but you can apparently try to store a huge number into a
short integer, and MySQL silently truncates to maxint.  No error.  No
warning.

No place for it in a real business environment. :(

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster


Re: [GENERAL] Birthsday list

2001-09-26 Thread Randal L. Schwartz

 Svenne == Svenne Krap [EMAIL PROTECTED] writes:

Svenne I kind of found the answer myself ... here are some snipplets ...
Svenne the table and the data :


Svenne CREATE SEQUENCE friends_friendid_seq start 1 increment 1 maxvalue
Svenne 2147483647 minvalue 1  cache 1 ;

Svenne CREATE TABLE friends (
Svenne friendid integer DEFAULT
Svenne nextval('friends_friendid_seq'::text) NOT NULL,
Svenne friendname character varying,
Svenne dateofbirth timestamp with time zone,
Svenne Constraint friends_pkey Primary Key (friendid)
Svenne );

Svenne COPY friends  FROM stdin;
Svenne 1   Tony1978-01-28 00:00:00+01
Svenne 2   Gary1966-06-04 00:00:00+01
Svenne 3   Jodie   1979-01-11 00:00:00+01
Svenne \. 


Svenne My query, works but looks clumbersome.. can it be made smarter ?

Svenne select * from (
Svenne (select *,date_part('year',now()) - date_part('year', dateofbirth) as
Svenne age,  date_part('doy',dateofbirth)-date_part('doy',now()) as daystogo
Svenne from friends where date_part('doy',dateofbirth) =
Svenne date_part('doy',now()))
Svenne union
Svenne (select *,date_part('year',now()) - date_part('year', dateofbirth ) +1
Svenne as age, date_part('doy',dateofbirth)-date_part('doy',now()) +
Svenne date_part('day', (now() + '1 year'::interval)::timestamp -  now()) as
Svenne daystogo from friends where date_part('doy',dateofbirth) 
Svenne date_part('doy',now(
Svenne  r order by r.daystogo

yeah, how about a little modular arithmetic?

select friendname, dateofbirth from friends
order by (366 + date_part('doy', dateofbirth) - date_part('doy', now())) % 366;

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]



Re: [GENERAL] [HACKERS] Tupple statistics function

2001-09-24 Thread Randal L. Schwartz

 Thurstan == Thurstan R McDougle [EMAIL PROTECTED] writes:

Thurstan In general EXPLAIN could be expanded to be a command to
Thurstan return an explanation and stats of many items.  There could
Thurstan also be EXPLAIN that only shows fields and EXPLAIN VERBOSE
Thurstan that also shows more detail such as stats (as that tends to
Thurstan take more time to collect).

It would also be interesting to take everything that psql does and put
each of them into a view so that it could be queried directly.
There's no reason that the magic should reside in client-side code.
It'd also make psql much simpler. :) I mean, why is \d anything
other than select * from pg_table_view;, with all the logic to
compute that table in the view code?

Unless having a view on the server is expensive.  Is a server view
expensive if nobody calls it?  I mean, it's not maintained like an
index, is it?

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html



Re: [GENERAL] Function Help

2001-09-24 Thread Randal L. Schwartz

 Brian == Brian C Doyle [EMAIL PROTECTED] writes:

Brian Hello all,
Brian I am working on a function to determine the date of the first saturday
Brian of the month.

Brian Currently I have:

Brian CREATE FUNCTION first_saturday(date)
Brian RETURNS date
Brian AS '
Brian Select CASE WHEN date_part(\'dow\',\'$1\'::DATE)=0 THEN date(\'$1\')+6
Brian WHEN date_part(\'dow\',\'$1\'::DATE)=1 THEN date(\'$1\')+5
Brian WHEN date_part(\'dow\',\'$1\'::DATE)=2 THEN date(\'$1\')+4
Brian WHEN date_part(\'dow\',\'$1\'::DATE)=3 THEN date(\'$1\')+3
Brian WHEN date_part(\'dow\',\'$1\'::DATE)=4 THEN date(\'$1\')+2
Brian WHEN date_part(\'dow\',\'$1\'::DATE)=5 THEN date(\'$1\')+1
Brian WHEN date_part(\'dow\',\'$1\'::DATE)=6 THEN date(\'$1\')+0
Brian END'LANGUAGE 'sql'

Brian I get an error that $1 is not a valid date.  But I want that to be the
Brian variable I enter...
Brian what Am I doing wrong???

Working too hard? :)

why not just:

My_Col + 6 - date_part('dow', My_Col)

Don't even need a function for that. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send unregister YourEmailAddressHere to [EMAIL PROTECTED])



Re: [GENERAL] creating user table

2001-09-23 Thread Randal L. Schwartz

 Chris == Chris  [EMAIL PROTECTED] writes:

Chris Hi,
Chris This one is more for the developers, but other comments welcome.

Chris Since we can't create a table called user in a normal database due to
Chris the reserved keyword problem,

False precondition!

template1=# create database demo;
CREATE DATABASE
template1=# \c demo
You are now connected to database demo.
demo=# create table user (name text, age int);
CREATE
demo=# \d
   List of relations
 Name | Type  | Owner  
--+---+
 user | table | merlyn
(1 row)

demo=# \d user
  Table user
 Attribute |  Type   | Modifier 
---+-+--
 name  | text| 
 age   | integer | 

demo=# insert into user values ('Randal', 39);
INSERT 1034607 1
demo=# insert into user values ('Russ', 38);
INSERT 1034608 1
demo=# insert into user values ('Ron', 35);
INSERT 1034609 1
demo=# select * from user order by age;
  name  | age 
+-
 Ron|  35
 Russ   |  38
 Randal |  39
(3 rows)

demo=# 

You can quote any reserved word to get any name you want.
You just need to think of the table name of demo as _ demo _.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly



Re: [GENERAL] PL/java?

2001-09-05 Thread Randal L. Schwartz

 Gunnar == Gunnar Rønning [EMAIL PROTECTED] writes:

Gunnar In the end there is however no proof to claim that Java applications
Gunnar are faster than mod_perl applications.

I'll settle for that.  Most of the time I've seen benchmarks, it's
been more the skillset of the programmers at stake rather than the
languages.

Gunnar But having Java in the PgSQL backend would be nice for some,
Gunnar regardless of how well Java compares to Perl.

Yes, I can support that.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster



Re: [GENERAL] PL/java?

2001-09-04 Thread Randal L. Schwartz

 Alex == Alex Knight [EMAIL PROTECTED] writes:

Alex You did not read what I wrote very well. First, I said that mod_perl was
Alex slower than most any j2ee application. If you knew what j2ee was,
Alex you'd know that it's generally limited to server-side internet apps
Alex like servlets, jsps, etc... 

If you'd just stop saying things that can't be backed up, I wouldn't
have to keep responding.

Where is your proof that mod_perl is slower than most any j2ee
application?

Alex However, in some cases, Java does things better (just like
Alex perl does things faster than Java in certain situations).

I'm still waiting for Java does things better to be demonstrated.

Alex But perl has had the most uses for so many years because it is
Alex easy to learn, not truely object oriented

Perl is a hybrid OO language, just like Java.  Now if you compare both
of them to Smalltalk, I see your point.  But Java has primitive types
that cannot be subclassed or extended, just like Perl.  There's really
no difference.  Perhaps you've not read Object Oriented Perl by
Damian Conway, to see just how rich Perl's object model is, even
compared to Java and others.

Alex  (atleast the past few
Alex years have been that way), does not require compiling to
Alex simplify the execution process (i.e. fully interpreted), etc.

Perl is no more interpreted than Java.  Perl's compiler translates the
entire program down to bytecodes, and the bytecodes are then executed
by the Perl Virtual Machine, just like Java.  (I won't bring up any
benchmarks here... it's unfair to Java. :)

See... it's the nonsense you keep spouting that makes me want to slap
you silly.  Get a clue.  Perl is a serious, mission-critical language,
being actively developed by hundreds of people who depend on it to
remain stable, fast, and useful.

I've seen both.  Java has its place.  Perl has its place.  Stop
dissing Perl, because you are apparently unaware of what is actually
going on.  I guess that would make you a language bigot.

Alex Expand on your enterprise application. A true enterprise application
Alex takes more than 3 days time to design and implement. Most real
Alex enterprise applications have multiple layers of logic, etc. I don't
Alex consider a script that queries a database for a password by 100,000
Alex people a day to really be considered as Enterprise either.

And many enterprise applications are completely in Perl.
cbs.sportsline.com is 90% Perl.  Etoys.com was 100% Perl.  imdb.com is
100% perl.  valueclick.com is 100% Perl.  Amazon.com does all their
backend processing in Perl.  Boeing uses Perl in every step of their
cad/cam process... every number defining the 777 airplane was passed
through Perl.

Alex If I was new to programming, and I started preaching Java
Alex right off the bat, this conversation wouldn't be warranted. In
Alex fact, I run into these types of Java developers who go around
Alex saying they think Java is the best language ever, etc etc but
Alex don't really have the experience to make that claim.

You smell a bit like that now though, mostly through your ignorance of
Perl.  Maybe you're not unfounded pro Java, but you are unfounded
anti Perl.  And I won't allow that here.  I'll certainly permit Perl
to lose on its technical merits, but I won't let Perl lose through
your ignorance of what it actually can be or do.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]