From: | James Harper <james(dot)harper(at)bendigoit(dot)com(dot)au> |
---|---|
To: | Merlin Moncure <mmoncure(at)gmail(dot)com> |
Cc: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: multiple results from a function |
Date: | 2014-03-03 22:09:57 |
Message-ID: | 6035A0D088A63A46850C3988ED045A4B6F3C2C8F@BITCOM1.int.sbss.com.au |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
> > I'm building against 9.3 at the moment, and my code is external to the
> > postgres process and using libpq connections, but I noticed that 9.4 allows
> > dynamic backend worker processes which would allow my code to run server
> > side and spawn a process for each TDS connection.
>
> Hm, interesting. I assume that this code is 'man in the middle';
> you've written a server that masquerades as a SQL server relays the
> request to postgres. That's going to be a lot of work but would be a
> fascinating project if you could pull it off.
That's about it. There are a few other differences too apart from the stored procs, like just about any default MSSQL collation is case insensitive. I ended up writing my own set of custom types that match the MSSQL types in terms of behaviour (eg case insensitive compare, varchar(max) works as expected, etc), with the advantage that because the types are mine I can send/recv in a binary format compatible with MSSQL. I've got the basic types working but a lot of the code is just placeholder at the moment, and I'm not exactly sure how I'll handle the billion different collations.
The multi-database issue is a bit of a pain too. MSSQL expects to be able to access different databases from the one connection but obviously postgres doesn't allow this. I've worked around this by incorporating the database name into the schema name, eg 'master.dbo' and maintaining the search path appropriately, which seems to work well.
Right now, I can:
. connect MSSQL Management Studio and log in
. create databases, logins, and users
. create tables, indexes, and constraints (probably missing a bunch of options)
. execute basic queries (SELECT, FROM, JOIN, WHERE, GROUP BY all seem to translate pretty cleanly)
. create stored functions and procedures
. execute simple procedures (not functions yet) with basic content (IF/WHILE work, probably lots of other stuff doesn't)
To be actually useful I need to flesh out the types fully, especially the decimal/numeric/money types which are totally just placeholders which just return 42, and implement cursors in stored procedures.
Ultimately I'd hope that any MSSQL application can connect and 'just work' without any modification. Not sure how I'll license it just yet.
James
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas Kellerer | 2014-03-03 22:59:25 | Re: multiple results from a function |
Previous Message | David Johnston | 2014-03-03 20:50:27 | Re: Efficiently delete rows not referenced by a foreign key |