Thread: PostgreSQL

PostgreSQL

From
"Ulisses Ponticelli Giorgi"
Date:
    Hi,

    I´m SQL Server 2000 user and want to migrate to PostgreSQL,
mainly because is the most suitable database to my needs (it is very
robust) and because the price of SQL Server is scaring all my clients.

    But I have a few problems with PostgreSQL that I'm stuck.

    1) In my SQL Server database I have about 1,000 Stored
Procedures. In some cases, one SP calls another SP that calls another,
and so on. To do that, I use the EXEC command. I've read that PostgreSQL
only supports functions. Is there any kind of trick that I can use in
PostgreSQL to make easier the conversion of all my SPs? How could I do
this? I just can't get all my SPs and rewrite the code.

    2) I use commands like CONVERT and CASE..WHEN..END in my
queries. This is another issue that I simply don't know what to do. Is
there any kind of library or product (if it exists, I but it) that can
solve this problem?

    Please, sorry my lack of knowledge in PostgreSQL. I'm a beginner
in this database, but I believe that is the answer to my problems, manly
because the SQL Server is unbearable to maintain.


Best Regards,

Ulisses Ponticelli Giorgi
  MSC Computer Science



Re: PostgreSQL

From
DeJuan Jackson
Date:
Welcome to the light.

Ulisses Ponticelli Giorgi wrote:

>    Hi,
>
>    I´m SQL Server 2000 user and want to migrate to PostgreSQL,
>mainly because is the most suitable database to my needs (it is very
>robust) and because the price of SQL Server is scaring all my clients.
>
>    But I have a few problems with PostgreSQL that I'm stuck.
>
>    1) In my SQL Server database I have about 1,000 Stored
>Procedures. In some cases, one SP calls another SP that calls another,
>and so on. To do that, I use the EXEC command. I've read that PostgreSQL
>only supports functions. Is there any kind of trick that I can use in
>PostgreSQL to make easier the conversion of all my SPs? How could I do
>this? I just can't get all my SPs and rewrite the code.
>
As far as I know there is no SQL Server compatibility for PostgreSQL.
So (not really related to the preceding statement), you will have to
rewrite your Stored Procedures.  And don't let the terms confuse you
most (if not all) Store Procs can be written using PostgreSQL functions
(a procedure is generally a function that returns nothing in programming
terms).  This will be the most painful point of the migration, but you
would/will have the same problem with migration to any other database.

>    2) I use commands like CONVERT and CASE..WHEN..END in my
>queries. This is another issue that I simply don't know what to do. Is
>there any kind of library or product (if it exists, I but it) that can
>solve this problem?
>

(In that I haven't read the SQL Server 2000 doc's take the following
statements with a grain of salt.)
for an appropriate reference start here:
http://www.postgresql.org/docs/view.php?version=7.3&idoc=1&file=functions.html
CASE is SQL standard => read will work in PostgreSQL as in SQL Server
2000  with little to no changes (Section 6.12.1 in the docs).
CONVERT is a type conversion function and would need to be rewritten
using the equivalent functions in PostgreSQL(Section 6.7 in the docs).

>
>    Please, sorry my lack of knowledge in PostgreSQL. I'm a beginner
>in this database, but I believe that is the answer to my problems, manly
>because the SQL Server is unbearable to maintain.
>
We all have to start somewhere, best to start with the Fine Manual.

>
>
>Best Regards,
>
>Ulisses Ponticelli Giorgi
>  MSC Computer Science
>
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 4: Don't 'kill -9' the postmaster
>
>



Re: PostgreSQL

From
"Shridhar Daithankar"
Date:
On 26 Jun 2003 at 19:09, Ulisses Ponticelli Giorgi wrote:
>     1) In my SQL Server database I have about 1,000 Stored
> Procedures. In some cases, one SP calls another SP that calls another,
> and so on. To do that, I use the EXEC command. I've read that PostgreSQL
> only supports functions. Is there any kind of trick that I can use in
> PostgreSQL to make easier the conversion of all my SPs? How could I do
> this? I just can't get all my SPs and rewrite the code.

I was under impression functions are stored procedures. I mean OK, if you write
them in PL/PgSQL. Shouldn't be a problem barring syntax differences..

HTH

Bye
 Shridhar

--
Fun experiments:    Get a can of shaving cream, throw it in a freezer for about a
week.    Then take it out, peel the metal off and put it where you want...
bedroom, car, etc.  As it thaws, it expands an unbelievable amount.