473,396 Members | 2,024 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,396 software developers and data experts.

Sequence question.

I'm working on an idea that uses sequences.

I'm going to create a table like this:

id serial,
sequence int,
keyword varchar(32),
text text

for every keyword there will be a uniq sequence for it eg:

id, sequence, keyword
1, 1, foo, ver1
2, 1, bar, bar ver1
3, 2, foo, ver2
4, 2, bar, bar ver2
etc...

I could have one sequence for all keyword which would be 1,3, etc... I
would be prefer to have them in sequence. I'm sure someone has ran into
this before, any ideas?

Anthony.
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 12 '05 #1
10 2567
How about using two tables; one to hold the keyword and its (last
allocated) sequence value, and the second to store your data as below.

create table Keyword (
keyword varchar(32),
sequence integer,
primary key(keyword)
)

create table Data (
id serial,
sequence int,
keyword varchar(32),
text text
)

Add a trigger to the Data table for Insert so that it joins to the
(parent) keyword table and increments the keyword.sequence value, and
places that into the Data.sequence value.

You will get 'holes' in the keyword sequencing when you delete data from
the Data table. If that's a problem then you will need an alternative
design.

Hope that helps.

John Sidney-Woollett

Anthony Best said:
I'm working on an idea that uses sequences.

I'm going to create a table like this:

id serial,
sequence int,
keyword varchar(32),
text text

for every keyword there will be a uniq sequence for it eg:

id, sequence, keyword
1, 1, foo, ver1
2, 1, bar, bar ver1
3, 2, foo, ver2
4, 2, bar, bar ver2
etc...

I could have one sequence for all keyword which would be 1,3, etc... I
would be prefer to have them in sequence. I'm sure someone has ran into
this before, any ideas?

Anthony.
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

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

Nov 12 '05 #2
Sorry I should have added that the trigger needs to create a new keyword
record if the join in the trigger fails to locate the keyword in the
keyword table.

Hopefully you can create the trigger yourself.

The keyword table is effectively a distinct list of all keywords inserted
into the data table with the associated last allocated sequence number for
the keyword.

John

John Sidney-Woollett said:
How about using two tables; one to hold the keyword and its (last
allocated) sequence value, and the second to store your data as below.

create table Keyword (
keyword varchar(32),
sequence integer,
primary key(keyword)
)

create table Data (
id serial,
sequence int,
keyword varchar(32),
text text
)

Add a trigger to the Data table for Insert so that it joins to the
(parent) keyword table and increments the keyword.sequence value, and
places that into the Data.sequence value.

You will get 'holes' in the keyword sequencing when you delete data from
the Data table. If that's a problem then you will need an alternative
design.

Hope that helps.

John Sidney-Woollett

Anthony Best said:
I'm working on an idea that uses sequences.

I'm going to create a table like this:

id serial,
sequence int,
keyword varchar(32),
text text

for every keyword there will be a uniq sequence for it eg:

id, sequence, keyword
1, 1, foo, ver1
2, 1, bar, bar ver1
3, 2, foo, ver2
4, 2, bar, bar ver2
etc...

I could have one sequence for all keyword which would be 1,3, etc... I
would be prefer to have them in sequence. I'm sure someone has ran into
this before, any ideas?

Anthony.
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

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

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 12 '05 #3
Apologies if this is a double post - I'm sure I sent a similar e-mail to
the list, but it seems to have disappeared in the ether.

Id there a definitive list of what replication options are currently
available for 7.4 (and 7.5), and what their relative strengths and
weaknesses are; ease of use, configuration, cost, support etc

I need to start tackling replication of our DB in the next few weeks, and
wondered what the options are.

I've seen RServer and Mammoth Replication - these look good (on paper) but
both appear to involve a license fee (which is more than I have to spend
right now).

Is pgReplication ready for 7.4 yet? And are there any other *free*
options? If not maybe I'll have to find the money for a commercial
solution.

I'd appreciate any feedback from anyone who has a working replication
solution.

Thanks

John Sidney-Woollett

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 12 '05 #4

On Dec 17, 2003, at 3:15 AM, John Sidney-Woollett wrote:
Apologies if this is a double post - I'm sure I sent a similar e-mail
to
the list, but it seems to have disappeared in the ether.

Id there a definitive list of what replication options are currently
available for 7.4 (and 7.5), and what their relative strengths and
weaknesses are; ease of use, configuration, cost, support etc

I need to start tackling replication of our DB in the next few weeks,
and
wondered what the options are.

I've seen RServer and Mammoth Replication - these look good (on paper)
but
both appear to involve a license fee (which is more than I have to
spend
right now).
There's 2 versions of eRServer - v1.2 is free on gborg and Postgresql,
Inc. has another
that you get with a support contract.

I've patched eRServer pretty heavily to fix some bugs and add some
usability. The
eRServer list has some discussion of these.

Jan Weick is in the early stages of developing a new replication system
that
looks to be pretty nice. He also has a project set up on gborg.

In addition, RServ (what eRServer was based on) is still going, along
with dbmirror
(which is in contrib in the main distribution).

Mammoth is something you would have to ask Joshua Drake about. Don't
know anything about it.

Is pgReplication ready for 7.4 yet? And are there any other *free*
options? If not maybe I'll have to find the money for a commercial
solution.
Doesn't look like based on the web site at gborg.

I'd appreciate any feedback from anyone who has a working replication
solution.

So far eRServer is working ok for me. If you use the unpatched version
on gborg, be sure to
read the erserver list archives, as the current tarball has a problem
or two. If you want to
work with my fork let me know. I like to think it works better, but I'm
hardly unbiased...
Thanks

John Sidney-Woollett

---------------------------(end of
broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if
your
joining column's datatypes do not match

--------------------

Andrew Rawnsley
President
The Ravensfield Digital Resource Group, Ltd.
(740) 587-0114
www.ravensfield.com
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 12 '05 #5
Andrew

Thanks for the info.

Can you detail more fully the changes you made to eRServer - v1.2, and
will your patched version work with 7.4?

John

Andrew Rawnsley said:

On Dec 17, 2003, at 3:15 AM, John Sidney-Woollett wrote:
Apologies if this is a double post - I'm sure I sent a similar e-mail
to
the list, but it seems to have disappeared in the ether.

Id there a definitive list of what replication options are currently
available for 7.4 (and 7.5), and what their relative strengths and
weaknesses are; ease of use, configuration, cost, support etc

I need to start tackling replication of our DB in the next few weeks,
and
wondered what the options are.

I've seen RServer and Mammoth Replication - these look good (on paper)
but
both appear to involve a license fee (which is more than I have to
spend
right now).


There's 2 versions of eRServer - v1.2 is free on gborg and Postgresql,
Inc. has another
that you get with a support contract.

I've patched eRServer pretty heavily to fix some bugs and add some
usability. The
eRServer list has some discussion of these.

Jan Weick is in the early stages of developing a new replication system
that
looks to be pretty nice. He also has a project set up on gborg.

In addition, RServ (what eRServer was based on) is still going, along
with dbmirror
(which is in contrib in the main distribution).

Mammoth is something you would have to ask Joshua Drake about. Don't
know anything about it.

Is pgReplication ready for 7.4 yet? And are there any other *free*
options? If not maybe I'll have to find the money for a commercial
solution.


Doesn't look like based on the web site at gborg.

I'd appreciate any feedback from anyone who has a working replication
solution.


So far eRServer is working ok for me. If you use the unpatched version
on gborg, be sure to
read the erserver list archives, as the current tarball has a problem
or two. If you want to
work with my fork let me know. I like to think it works better, but I'm
hardly unbiased...
Thanks

John Sidney-Woollett

---------------------------(end of
broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if
your
joining column's datatypes do not match

--------------------

Andrew Rawnsley
President
The Ravensfield Digital Resource Group, Ltd.
(740) 587-0114
www.ravensfield.com

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 12 '05 #6
Check out the pg_replicator project on gborg, IIRC it has links to some
of the replication solutions.... USOGRES comes to mind...

BTW - I'f you do give each one a twirl, we'd love to hear about your
experiences.

Robert Treat

On Wed, 2003-12-17 at 03:15, John Sidney-Woollett wrote:
Apologies if this is a double post - I'm sure I sent a similar e-mail to
the list, but it seems to have disappeared in the ether.

Id there a definitive list of what replication options are currently
available for 7.4 (and 7.5), and what their relative strengths and
weaknesses are; ease of use, configuration, cost, support etc

I need to start tackling replication of our DB in the next few weeks, and
wondered what the options are.

I've seen RServer and Mammoth Replication - these look good (on paper) but
both appear to involve a license fee (which is more than I have to spend
right now).

Is pgReplication ready for 7.4 yet? And are there any other *free*
options? If not maybe I'll have to find the money for a commercial
solution.

I'd appreciate any feedback from anyone who has a working replication
solution.

Thanks

John Sidney-Woollett

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match


--
Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 12 '05 #7
On Thu, Dec 18, 2003 at 03:40:44PM -0500, Robert Treat wrote:

I've seen RServer and Mammoth Replication - these look good (on paper) but
both appear to involve a license fee (which is more than I have to spend
right now).


For the record, there is an open source version of erserver. It's
available on gborg.

A

--
----
Andrew Sullivan 204-4141 Yonge Street
Afilias Canada Toronto, Ontario Canada
<an****@libertyrms.info> M2P 2A8
+1 416 646 3304 x110
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 12 '05 #8
Robert

Thanks for the info.

I'll keep the list posted with feedback after I decide which product to go
with.

John

Robert Treat said:
Check out the pg_replicator project on gborg, IIRC it has links to some
of the replication solutions.... USOGRES comes to mind...

BTW - I'f you do give each one a twirl, we'd love to hear about your
experiences.

Robert Treat

On Wed, 2003-12-17 at 03:15, John Sidney-Woollett wrote:
Apologies if this is a double post - I'm sure I sent a similar e-mail to
the list, but it seems to have disappeared in the ether.

Id there a definitive list of what replication options are currently
available for 7.4 (and 7.5), and what their relative strengths and
weaknesses are; ease of use, configuration, cost, support etc

I need to start tackling replication of our DB in the next few weeks,
and
wondered what the options are.

I've seen RServer and Mammoth Replication - these look good (on paper)
but
both appear to involve a license fee (which is more than I have to spend
right now).

Is pgReplication ready for 7.4 yet? And are there any other *free*
options? If not maybe I'll have to find the money for a commercial
solution.

I'd appreciate any feedback from anyone who has a working replication
solution.

Thanks

John Sidney-Woollett

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if
your
joining column's datatypes do not match


--
Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 12 '05 #9
>
Mammoth is something you would have to ask Joshua Drake about. Don't
know anything about it.
Just FYI: There is very detailed information about Mammoth Replicator
located here:
http://www.commandprompt.com/entry.lxp?lxpe=304
Sincerely,

Joshua D. Drake

Is pgReplication ready for 7.4 yet? And are there any other *free*
options? If not maybe I'll have to find the money for a commercial
solution.

Doesn't look like based on the web site at gborg.

I'd appreciate any feedback from anyone who has a working replication
solution.


So far eRServer is working ok for me. If you use the unpatched version
on gborg, be sure to
read the erserver list archives, as the current tarball has a problem or
two. If you want to
work with my fork let me know. I like to think it works better, but I'm
hardly unbiased...
Thanks

John Sidney-Woollett

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if
your
joining column's datatypes do not match

--------------------

Andrew Rawnsley
President
The Ravensfield Digital Resource Group, Ltd.
(740) 587-0114
www.ravensfield.com
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

--
Command Prompt, Inc., home of Mammoth PostgreSQL - S/ODBC and S/JDBC
Postgresql support, programming shared hosting and dedicated hosting.
+1-503-667-4564 - jd@commandprompt.com - http://www.commandprompt.com
Mammoth PostgreSQL Replicator. Integrated Replication for PostgreSQL
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 22 '05 #10
Hello,

I'am using postgresql to make different web site with differente
database for each, but with same table/link/...
So, i change from 7.2 to 7.4 and try to use template function to create
each new DB more easier (with user posgres):

CREATE DATABASE myowntemplate TEMPLATE = template1;

After that, i create the differentes tables.

I create my user and create the db for each user :

CREATE DATABASE user_db OWNER = user TEMPLATE = myowntemplate;

Update data, and try it.

But i got a msg in the postgresql.log that my user have not the
permission to access the tables :

ERROR: permission denied for relation table1
ERROR: permission denied for relation table2
[...]

So maybe i made a mistake, by i thought by making "user" the owner of
"user_db", he will gain each priviliges on "myowndb".

Thanx for answers,
regards,

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

Nov 23 '05 #11

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

Similar topics

4
by: j | last post by:
In a footnote in the c99 standard the following is labeled as undefined: a = i; And in the second clause of section 6.5 the following is stated: "Between the previous and next sequence...
18
by: Andy Green | last post by:
Emphasis is on efficiancy and speed this is the excercise: The program should monitor a possibly infinite stream of characters from the keyboard (standard input). If it detects the sequence "aaa"...
5
by: Eric E | last post by:
Hi, I have a question about sequences. I need a field to have values with no holes in the sequence. However, the values do not need to be in order. My users will draw a number or numbers from...
1
by: Marek Lewczuk | last post by:
Hello, I would like to ask if my problem with sequence is a proper behavior or this is a bug (probably not)... I have a table: CREATE TABLE "testtable" ( "serialfield" SERIAL,...
3
by: kevin | last post by:
Is that even possible? I am creating a web service in .NET to expose some already created .NET programs to other groups. One group is writing the client in PERL, and thus wishes the wsdl schema...
14
by: pat270881 | last post by:
hello, I have to implement a sequence class, however the header file is predefined class sequence { public: // TYPEDEFS and MEMBER CONSTANTS
2
by: Kai-Uwe Bux | last post by:
Please consider #include <iostream> int main ( void ) { int a = 0; a = ( (a = 5), 4 ); // (*) std::cout << a << '\n'; }
3
by: somenath | last post by:
Hi All, I have one question regarding the conditional operator. In the draft C99 standard it is mentioned that "1 The following are the sequence points described in 5.1.2.3: -- The call to a...
5
by: majestik666 | last post by:
Am not sure if it's been asked before (did a search but didn't come up with anything related...). I'm trying to write some code to "collapse" image sequences into a single item , i.e.:...
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: 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
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
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
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...
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...
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
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...

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.