Stored Procedures: Which is more similar to SQL Server 2000 - Postgresql or MySQL
I have a SQL Server 2000 database with a lot of stored procedures开发者_如何学Go. I want to migrate to a open source database and well I know I will have to re write the procedures but I would like to do this with as little effort as possible
Neither are a direct port, but of the two -- MySQL's syntax is more similar to SQL Server's than PostgreSQL.
SQL Server 2000 didn't have analytic/ranking/windowing functionality -- neither does MySQL currently. Also, no WITH/CTE support - again, MySQL doesn't support this either. If you were migrating away from SQL Server 2005+, I'd have recommended PostgreSQL 8.4+ for the sake of either of the two things I just mentioned.
MySQL's stored procs are really basic, for instance you cannot raise an exception from within a proc, which makes error handling REALLY PAINFUL. Also, debugging stored procs is a pain, the error messages are unclear, and the language itself is pretty limited.
Postgres is much more mature for this ; if your app has lots of stored procs, this pretty much rules out mysql.
MySQL supports stored procedures, per se; PostgreSQL supports stored functions, which are in practice very similar. The first query language for PostgreSQL, PL/pgSQL, is similar to Oracle's PL/SQL. PostgreSQL supports SQL:2003 PSM stored procedures as well as many other general purpose programming languages such as Perl (PL/Perl), Python (PL/Python), TCL (PL/Tcl), Java (PL/Java) and C (PL/C). MySQL follows the SQL:2003 syntax for stored routines, which is also used by IBM's DB2. —MySQL AB , MySQL 5.1 Reference Manual :: 18 Stored Procedures and Functions Via the plugin interface MySQL supports external language stored procedures in Java, Perl, XML-RPC with more language plugins in the works.
from link text
精彩评论