473,830 Members | 2,114 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

finding my schema (for sequences)

I am used to creating sequences separately and using them for default
values instead of using the serial type. I am not sure why... but that's the
way I have been doing it. Maybe I don't trust the generated names.
I should probably just get over it, but anyhow...

Let's say I am writing a file for creating a database. Say ...

-- schematest
CREATE SEQUENCE foo_id_seq;
CREATE TABLE foo(
id integer
PRIMARY KEY
DEFAULT nextval('foo_id _seq'),
xx text
);
I want to be able to ...

lee=# drop schema beta cascade;
DROP SCHEMA
lee=# create schema beta;
CREATE SCHEMA
lee=# set search_path to beta;
SET
lee=# \i schematest
CREATE SEQUENCE
CREATE TABLE
The problem is that unlike a comparable serial column, my default value
does not qualify the sequence with the right schema name.

Is there a way to do that, such that my schematest file does not need to
know which schema I am loading the file into?

Or should I just get over my aversion to serial?

_______________ _______________ _______________ _______________ _____
Working moms: Find helpful tips here on managing kids, home, work — and
yourself. http://special.msn.com/msnbc/workingmom.armx
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 12 '05 #1
0 1307

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

Similar topics

2
8576
by: Ted | last post by:
How do I grant all privileges for a schema that has a large number of existing tables, procedures, functions, etc to a newly created role, without having to issue a grant statement for each object and each privilege? I want the role to have all of the rights of the schema owner. Is there any kind of blanket granting of all privileges to a role?
3
3836
by: Kevin Campbell | last post by:
Say I have the following XML spec: <Book> <Title /> <Author /> <ISBN /> <Description /> </Book> Title, Author, ISBN and Description may appear in any order. Title,
3
25710
by: Pioneer | last post by:
How to see diferent schemas in DB2 database? Further, how to see all tables in that schema?
2
2783
by: Lee Harr | last post by:
I must have a fundamental misunderstanding about using schema. Before using schema, I usually have a file that has my database definition, and I can play that file back in to a new database to create a testing area or to create my production setup. I think I want to use schema the same way. My problem is using a sequence for a default value. I know that if I use a serial instead, all of this will go away, but my design
3
1982
by: Peter Darley | last post by:
Folks, I have a couple of databases that should really be schemas in the same database. I tried to find suggestions on how to easily move all the tables/sequences/etc. from the public schema in a database to a different schema in a different database, but came up blank. If anyone has a suggestion it would be appreciated. Thanks, Peter Darley
1
15424
by: zeus | last post by:
Hi there, I am using Postgresql 7.3 and I want to grant select rights to a user on all tables in a schema, including those that may be created in the future but whose names are not yet known. I want to do something like: GRANT SELECT ON <schema>.* TO <user>; but select isn't a valid privilege on a schema and I don't see how wildcards are supported. Is there a way to do this, or does a table need to exist before a user can be granted...
16
4312
by: Bob Stearns | last post by:
The syntax diagram of DROP SCHEMA requires RESTRICT. Is there an easy way to drop an old, unnecessary, but populated schema?
2
2786
by: shumaker | last post by:
I designed a schema in VS C# 2005 Express and am wondering why it chooses to place a sequence tag around the elements of a table. And additionally, if I move the elements around within the table, the sequences in the *.xsd are not rearranged, but are left as is(in the order in which the elements were created in the table). Being a noob to xml, I'm just wondering: 1. Why is the sequence tag automatically added? 2. Why is it not updated...
4
1291
by: Noiroi | last post by:
Greetings - Below you'll find a sample of my schema. What I'm trying to accomplish is for any xml file created against this schema not to validate with only element1. <xsd:element name="PSD" type="RootDocumentType"/> <xsd:complexType name="RootDocumentType"> <xsd:sequence> <xsd:element name="element1"/>
0
9791
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
9642
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10487
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...
1
10525
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9313
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
7745
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
6950
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
5780
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4411
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.