473,394 Members | 1,703 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Creating Functions in Separate Schema

Our application currently runs in Microsoft SQL Server and we are
porting it over to Postgres. When we write enbedded SQL queries for SQL
Server, we need to reference user-defined functions with the prefix
"dbo." (e.g., "dbo.Function_Name()"). In experimenting with Postgres,
it appears that we can create a schema called "dbo" and then reference
functions with the same syntax (e.g., "dbo.Function_Name()").

We're trying to understand whether there will be any disadvantages to
doing this. Are there any possible issues or problems with this
approach? Any help will be greatly appreciated. Thanks.
Nov 23 '05 #1
3 5078
Hi Mark,

Am Do, den 26.08.2004 schrieb Mark Dexter um 23:42:
Our application currently runs in Microsoft SQL Server and we are
porting it over to Postgres. When we write enbedded SQL queries for
SQL Server, we need to reference user-defined functions with the
prefix "dbo." (e.g., "dbo.Function_Name()"). In experimenting with
Postgres, it appears that we can create a schema called "dbo" and then
reference functions with the same syntax (e.g.,
"dbo.Function_Name()").

We're trying to understand whether there will be any disadvantages to
doing this. Are there any possible issues or problems with this
approach? Any help will be greatly appreciated. Thanks.

This is generally not a problem. The search order
depends on the current user, so if there is a schema
with same name as the current user, its the first to search
in (and the one to put new objects in) but if you
always specify the schema name with your objects you
should not expect any problems and can use as many
schemas you want.

Regards
Tino Wildenhain
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 23 '05 #2
Mark Dexter wrote:
Our application currently runs in Microsoft SQL Server and we are
porting it over to Postgres. When we write enbedded SQL queries for SQL
Server, we need to reference user-defined functions with the prefix
"dbo." (e.g., "dbo.Function_Name()"). In experimenting with Postgres,
it appears that we can create a schema called "dbo" and then reference
functions with the same syntax (e.g., "dbo.Function_Name()").

We're trying to understand whether there will be any disadvantages to
doing this. Are there any possible issues or problems with this
approach? Any help will be greatly appreciated. Thanks.


Only that you'll need to be careful if you have two functions with the
same name in different schemas. If you have dbo.fn() and public.fn() and
call fn() then which you get will depend on your search_path.

--
Richard Huxton
Archonet Ltd

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

Nov 23 '05 #3
On Thu, 2004-08-26 at 22:42, Mark Dexter wrote:
Our application currently runs in Microsoft SQL Server and we are
porting it over to Postgres. When we write enbedded SQL queries for
SQL Server, we need to reference user-defined functions with the
prefix "dbo." (e.g., "dbo.Function_Name()"). In experimenting with
Postgres, it appears that we can create a schema called "dbo" and then
reference functions with the same syntax (e.g.,
"dbo.Function_Name()").

We're trying to understand whether there will be any disadvantages to
doing this. Are there any possible issues or problems with this
approach? Any help will be greatly appreciated. Thanks.


It should work fine.

If you set the search_path to include dbo, the "dbo." prefix would
become optional.

CREATE SCHEMA dbo;

CREATE FUNCTION dbo.function() ...

SELECT dbo.function() ...

SET SEARCH_PATH TO '...,dbo,public';

SELECT function() ...

Oliver Elphick
---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Fendi Baba | last post by:
Hi everyone I am new in this so please bear with me. I am trying to create a schema for a Quotation document. I created the creating the forms using Microsoft Infopath. I am creating my own...
0
by: Jeremy Summers | last post by:
Has anyone run into problems creating typed datasets from complex schemas? I am attempting to create a Typed Dataset in Visual Studio .Net from a .xsd schema file for a industry standard web...
3
by: Kiran | last post by:
Hi, I want to back up my data in some table in SQL server and import it back using Bulk Load of SQL server 2K. I can use the following code to backup the data in XML ...
1
by: Homer Simpson | last post by:
Hi Everyone, I would like to create a DLL to store my common math functions and then call the DLL from multiple apps. For example, I am creating a function called "Distance" that will return the...
3
by: Sindarian | last post by:
I have a Schema from the folk that shows how they want the data received. I have my own database that has that data, but in a different way (they use 33 freaking tables to store what I do in 1)....
3
by: Tyranno.Lex | last post by:
I am using Visual Studio .NET 2003 and have successfully deployed a commercial web application written in C# and ASP.NET. I am now wanting to add reporting using Crystal Reports and am having a...
4
by: Samuel | last post by:
Hi, I am looking for a library that takes an XML file that specifies a table structure, and generates the CREATE/DROP/ALTER SQL statements to create the tables in the database. In particular,...
0
by: jackfrancy | last post by:
Hi , When I tried to create web reference (Proxy Class) from WSDL.EXE or Visual Studio 2003 web Reference Tool Following error has occurred . “The error message from each known type may help...
3
by: %NAME% | last post by:
Suppose I am an admin of a database instance. Now I need to specify that user A has the right to create tables in his own schema, but not anywhere else. In order to let user A create tables, i...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.