473,473 Members | 1,826 Online
Bytes | Software Development & Data Engineering Community
Create 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 1272

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

Similar topics

2
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...
3
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
by: Pioneer | last post by:
How to see diferent schemas in DB2 database? Further, how to see all tables in that schema?
2
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...
3
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...
1
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...
16
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
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,...
4
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"...
0
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,...
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,...
1
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.