473,811 Members | 3,256 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_N ame()"). 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_N ame()").

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 5103
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_N ame()"). 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_N ame()").

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*******@postg resql.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_N ame()"). 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_N ame()").

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_N ame()"). 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_N ame()").

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
1695
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 schema using XMLSpy. However when I try to use the Schema in Infopath, its says that it can only create based on one root element implying, I have more than one. The sample files that came with XMLSpy also shows more than one root element though the...
0
2431
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 service. I have run the schema through XML Spy and validated it with no errors, but when attempting to generate a dataset, I keeping getting a 'undefined data type' error. The schema is quite large so I don't know if that is causing the problem or...
3
8096
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 dataset.WriteXml(@"C:\Data.xml"); dataset.WriteXmlSchema(@"C:\Schema1.xml");
1
2735
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 3D distance between two points. The points are passed to the function as arguments and in return, the function gives me the 3D distance. I want to store the function in a DLL (which will contain many functions, hopefully) separate from my main...
3
1515
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). Now then, do I: a) Create a data source that jives with their schema (say, a number of views or store procedure to represent those 33 tables, but gets it's data from my 1 table) and then create the XML file off of that or... b) Read their Schema,...
3
3049
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 devil of a time doing this. The problem is that my application uses an encapsulated data tier for accessing the database vs. accessing it directly via the client tier. However, EVERY example that I have ever seen for creating a Crystal Report at...
4
1428
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, I am trying to port a PHP application that currently uses the AdoDB XML schema:
0
1480
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 you fix the problem: - A schema with the namespace 'http://www.opentravel.org/OTA/2003/05' has alre ady been added. - The document format is not recognized. - Report from 'XML Schema' is 'Expected Schema root. Make sure that the root ele ...
3
4397
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 grant createtab to that user. However, that would enable the user to create tables in other schemas as well (except those sys schema). Any way to restrict the users from creating objects in other schema than their own?
0
9731
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10651
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10393
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9208
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7671
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6893
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5556
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5697
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4342
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.