[Asterisk-Dev] Re: PostgreSQL support in Asterisk 1.2?

Bob Goddard asterisk at bgcomp.co.uk
Tue Aug 9 09:34:45 MST 2005


On Tuesday 09 Aug 2005 17:22, Peter Nixon wrote:
> On Wednesday 03 August 2005 22:34, Bob Goddard wrote:
> > On Wednesday 03 Aug 2005 18:58, Andrew Kohlsmith wrote:
> > > On Wednesday 03 August 2005 10:00, Matthew Simpson wrote:
> > > > What a crock of crap.  I've been running mysql for years and never
> > > > once had "mangled data".
> > >
> > > Only because you're taking the DB's job of data consistency in your
> > > own apps. Any DB that'll let me insert text values into numeric
> > > fields, accept totally bogus dates or even chop text fields without so
> > > much as throwing a WARNING is no good.  Period.
> >
> > I think you are basing your argument on old code.
> > For both inserts with the bogus data, I get warning
> > and "blank" data.
> >
> >
> > eth5:# mysql -u root -p
> > Enter password:
> > Welcome to the MySQL monitor.  Commands end with ; or \g.
> > Your MySQL connection id is 17923 to server version: 4.1.10a-Max
> >
> > Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
> >
> > mysql> create database crap;
> > Query OK, 1 row affected (0.06 sec)
> >
> > mysql> use crap;
> > Database changed
> > mysql> create table crap (crap1 int(10), crap2 date);
> > Query OK, 0 rows affected (0.13 sec)
> >
> > mysql> insert into crap values (22, "2005-11-11");
> > Query OK, 1 row affected (0.00 sec)
> >
> > mysql> insert into crap values ("crap", "crap");
> > Query OK, 1 row affected, 2 warnings (0.00 sec)
> >
> > mysql> insert into crap values ("crap", "2005-43-43");
> > Query OK, 1 row affected, 2 warnings (0.00 sec)
> >
> > mysql> select * from crap;
> > +-------+------------+
> >
> > | crap1 | crap2      |
> >
> > +-------+------------+
> >
> > |    22 | 2005-11-11 |
> > |     0 | 0000-00-00 |
> > |     0 | 0000-00-00 |
> >
> > +-------+------------+
> > 3 rows in set (0.01 sec)
>
> What you have done here is proven exactly why you shouldn't use MySQL.
>
> The 2nd and 3rd queries should have FAILED with an error, NOT inserted
> mangled data. The problem you now have is that you don't know if the zeros
> you have in your table were inserted by you, or plucked our of the air by
> MySQL!! You have now compromised the integrity your entire table!!!

The issue was that it would insert crap data without errors or warnings.
What was inserted, although it may not be what you want, is valid.
The other point is that it was flagged as a warning.



More information about the asterisk-dev mailing list