Hi,
I have BOTH a sql AND db design question.
I'm creating a cookbook DB with have broken the table into this:
RECIPE TABLE
Column | Type | Modifiers
---+--+--
id | integer | not null default nextval('r
this is a small sample of the data:
short_desc
| long_desc
--+---
Mark Roberts wrote:
On Wed, 2008-06-11 at 14:41 -0400, PostgreSQL Admin wrote:
I would like to have multiple values nutrient_no:
ndb_no | nutrient_no | nutrient_value
+-+
13473 | 203 | 24.18
13473 | 204 | 15.93
13473
Steve Crawford wrote:
PostgreSQL Admin wrote:
I have a table ...
when I run this query:
select ndb_no, nutrient_no, nutrient_value from nutrient_data where
ndb_no = 13473;
it produces:
ndb_no | nutrient_no | nutrient_value
+-+
13473 | 203
I have a table like this:
usda=# \d nutrient_data
Table "public.nutrient_data"
Column | Type | Modifiers
-+---+---
ndb_no | integer | not null
nutrient_no | integer | not null
I have a inventory system design in which I would like some help with to
see if it's efficient. The products are broken into:
Product tables
Property tables
Configurable Products - this would include colors (i.e. - black, blue
and green) tied to products
I'm thinking of breaking inventory in
Simple question - but my brain is not working:
This is my table
Column | Type |
Modifiers
---++-
id| integer
We are using this bad piece of the software that does not close
connections to the postgres server. Is there some setting for closing
dead connections? And not TCP/IP keep alive does not work.
---(end of broadcast)---
TIP 4: Have you searched our
No problems with the design - I was not thinking with the DB hat on at
first. I have been working on clustering for a while... just adjusting.
Thanks everyone.
:)
---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings
This is my layout so far:
CREATE TABLE users (
id serial NOT NULL,
--question REFERENCES questions(id) ON DELETE CASCADE ## ON REMOVED##
);
CREATE TABLE questions (
id serial NOT NULL,
questions varchar(450) NOT NULL
);
CREATE TABLE answers (
id serial NOT NULL,
question_id int REFERENCES questi
I have a table in which people will have a number of questions to
answer. I want those pk to be placed in my user table. So if a user
answers three question I want those 3 pk's in the user table (fk).
What should I be doing?
Thanks in advance,
J
---(end of broadcast)
chester c young wrote:
> how are you preventing recursion?
>
>
That could be the problem, suggestions?
---(end of broadcast)---
TIP 4: Have you searched our list archives?
http://archives.postgresql.org
I want to write a trigger that updates a different row on the same
table. It's pretty basic: before the any row in his table updated I
want to set a only row that has the value true to false. I keep getting
this error:
SQL statement "update theirry.articles set master_featured = false where
mast
> --- Richard Broersma Jr <[EMAIL PROTECTED]> wrote:
>
>> CREATE UNIQUE INDEX Only_one_row_true
>> ON Your_table ( featured )
>>WHERE featured = true;
>>
>> Or if you want to only allow 1 featured article per catagory then:
>>
>> CREATE UNIQUE INDEX Only_one_row_true_per_catag
I have a question that I've thought in my head about using triggers, but
I figure to ask people that do SQL more than I. So, I have a table that
I want two columns.
(1) A featured column which is for only 1 row, once it switched to
another row than all other rows must be false
title
As anyone used pgmemcache? I would like to look more into a but I'm
having problems installing the sql. I'm on OS X 10.4 and the sql there
are lines causing errors:
(e.g. AS '$libdir/pgmemcache', 'memcache_server_add' LANGUAGE 'C' STRICT;)
thanks for any input and also will version 1.2 come
Hi,
This is seemly simple, but I'm @ a loss this early in the morning. It's
best explained this way
SAMPLE
---
id | serial|
username | varchar(100)| constraint username >=8 and username <=100
The problem is that it's characters not
test=*# select regexp_replace(regexp_replace('The blue fox\'s fur.', ' ', '-',
'g'), '\\.', '');
regexp_replace
The-blue-fox's-fur
(1 row)
Andreas
Thanks for the input.
I came up with this:
REPLACE(regexp_replace('The blue fox\'s fur', '[[:punct:]]', ''), ' ',
Hi,
I want to replace a title with dashes and also remove punctuation.
e.g, The blue fox's fur. -> The-blue-fox-fur
Thanks for any input,
J
---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
su
Thanks,
The search path was the problem. Sometimes it's the simple things.
Big thanks,
J
---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster
Tom Lane wrote:
PostgreSQL Admin <[EMAIL PROTECTED]> writes:
CREATE OR REPLACE FUNCTION insert_staff_b
(insert_firstname varchar)
RETURNS VOID AS
...
Still I get this error:
Warning: pg_query(): Query failed: ERROR: function
insert_staff_b(character varying) does not exist
Thanks for the catch. I've tried:
$connection->execute("SELECT
insert_staff_b('$staff[insert_firstname]'::varchar)");
$connection->execute("SELECT
insert_staff_b('".$staff['insert_firstname']."'::varchar)");
None work... I'm scratching my head on this one.
Thanks,
J
I'm having this problem inserting data from my form using PL/pgSQL.
Here is the simplified version of my table and function (this example
does not work, also ):
CREATE TABLE theirry.sample (
staff_id serial PRIMARY KEY NOT NULL,
firstname varchar(100),
lastname varchar(150),
usern
Ok. I think I found the problem is related to this Bug.
is there anywhere to check the status of this bug?
regards,
=
Riccardo G. Facchini
---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster
Sorry. I realize I slipped an error in my code:
the code is:
---
CREATE TABLE public.imp_test
(
id int8,
value text
) WITHOUT OIDS;
CREATE OR REPLACE FUNCTION public.imp_test_to_out_test(imp_test)
RETURNS imp_test AS
'begin
return $1;
end;'
LANGUAGE 'plpgsql' ST
Hi all,
first of all, let me explain what I'm trying to do.
I have a table with a fairly complicated trigger. In this trigger I
have a specific set of codelines that can be executed in more than 50
places that works on the new.* fields in order to fix/clean them.
In order to improve readability,
On postgres 7.2.3 I have found what follows:
explain select * from documents where iddoc>1;
Seq Scan on lotti (cost=0.00..831.79 rows=26783 width=98)
EXPLAIN
explain select * from documents where iddoc=1;
Index Scan using lotti_pkey on lotti (cost=0.00..2.26 rows=1 width=98)
Why index is n
I have been tring to use index on timestamps:
I have a table with a timestamp filed with index on it.
I nned to extract all the ids of the table with datarx
>= a date
<= a date
or between 2 dates
I found that the only way to force postgres to use index is:
explain select id,datarx::da
HI!
I'm new to postgres. I need to have a table as a copy of another one.
Example:
CREATE TABLE one (
fileda INTEGER,
filedb INTEGER,
filedc INTEGER );
CREATE TABLE two (
fileda INTEGER,
filedb INTEGER,
filedc INTEGER );
As on insert to table o
CREATE TABLE tablename (colname SERIAL);
okay, but how do I set the beginning number. So far the only thing I
have been able to do is directly after creating the serial column, I do:
select setval('tablename_colname_seq', 15753);
Is this the only way to set the beginning number of a sequence?
or must be used when
-twolevel_namespace is in effect
make[3]: *** [libpq.so.2.1] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all] Error 2
make: *** [all] Error 2
[localhost:/Users/postgres/postgresql-7.1.3] root# make -v
GNU Make version 3.79, by Richard Stallman and Roland McGrath.
Bui
out why I would EVER want one. Which leads me to think that I
just don't understand them.
Please, if someone has a good example..
Ted
[EMAIL PROTECTED]
-Original Message-
From: Francesco Casadei <[EMAIL PROTECTED]>
To: postgresql <[EMAIL PROTECTED]>
Date: Sat, 22 Sep
Where can I get more information and examples on using JOINs. I
have been reading over the Chapter 2 on from the interactive user
docs but I need a little more in the way of examples. I am having a
problem understanding when I would need a LEFT or RIGHT JOIN.
Please, a 'point' in the right
27;, outer joins, left
joins. I get lost. Where can I get more info. I really want to
understand.
Thanks for your time. I guess it's back to the bookstore.
-Original Message-
From: "Joseph Syjuco" <[EMAIL PROTECTED]>
To: "postgresql" <[EMAIL PROT
At times things seem just too easy, so I want to confirm that this is the
correct syntax.
I am looking for the interval (aging) for these invoices. I guess I am
concerned because I guessed at the syntax. Is there a better way to do
this?
billdate is type 'date'
SELECT ('now'-billdate) FROM f
I am experimenting with running PG 7.1.2 on Mac OSX. I seem to
have a problem with getting my users to connect. This works
beautifully when connect to my linux box.
Any ideas?
[localhost:/etc] postgres% /usr/local/pgsql/bin/postmaster -i -p5444 -D
/users/postgres/pgdata
DEBUG: database sys
Is there a way to return the current oid of a transaction?
I am trying to:
begin;
insert into db something;
select current session oid
commit;
I will only ever be inserting one row during the transaction.
Is this doable?
Thanks for your time.
Ted
---(end of broad
gsql';
All is ok at creation.
But now , how can i use my function ? i would like a thing like :
SELECT tester(14) AS ok;
But is make a Postgresql parser error
How to do then ??
Thanks for any help or links (other than the postgresql.org website...) !
;)
Regards,
Fred
-
Hi,
How to create a foreign key in postgresql ?
need triggers ?
Thanks,
Fred
---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster
Hi,
I have a table of categories (it's pseudo-sql...) :
CATEGORIES
(
id_category PRIMARY KEY,
id_category_parent (FOREIGN KEY ? CONSTRAINT ??) ,
cat_text
)
There is recursivity : id_category_parent is -1 (= no parent cat) or the
id_category of a category in this table.
What is the S
I have started my pg installation using port 5444 (with the -p 5444
switch). Everything is working fine inside my installation with the
internal ip number (a 192.168 number). I created a tunnel in my
firewall to point to the linux box running pg with the port 5444 open. I
can not seem to get t
I guess the subject line says ithas anyone tried running
PostgreSQL in MAC OS X.
I see that in the product brochure, Apple specifically mentions Mysql.
I run a shop that has all mac computers. I am runnng just 1 linux box
(SUSE Linux on a Max G3) to run the job tracking system.
Please
n
passing it back to my app. commit, then do an update. I can not
seem to get the seq to work.
Ted
-Original Message-
From: Michael Fork <[EMAIL PROTECTED]>
To: postgresql <[EMAIL PROTECTED]>
Date: Thu, 29 Mar 2001 10:04:46 -0500 (EST)
Subject: Re: [SQL] serial type; race co
How does currval work if you are not inside a transaction. I have
been experimenting with inserting into a table that has a sequence.
If the insert fails (not using a transaction) because of bad client input
then the next insert gets the proper next number in the sequence.
given sequence 1,2,3
e accounted for as used or null. But it should not skip.
Thanks,
Ted
-Original Message-----
From: Michael Ansley
<[EMAIL PROTECTED]>
To: 'postgresql' <[EMAIL PROTECTED]>
Date: Fri, 23 Mar 2001 13:22:09 -
Subject: RE: [SQL] creating "job numbers"
>
that people with more expierence might
shed a little light here.
Thanks for your time.
Ted
-Original Message-
From: Jan Wieck <[EMAIL PROTECTED]>
To: postgresql <[EMAIL PROTECTED]>
Date: Thu, 22 Mar 2001 14:48:19 -0500 (EST)
Subject: Re: [SQL] creating "job numbers&q
I have been working with PG for about 2 months now. I am creating a
job tracking system for my company. I have written a front end on the
workstations (all macintoshes) that seems to be working quite well.
However, I have a problem with a concept.
In my current setup I have only one workstati
I have a table that I want to add a serial type column. Is there a way
to add it or do I have to create a new table and insert into it. I have
experimented with:
insert into newdb (name) select name from olddb order by jobno;
however, pg does not allow the 'order by' during an insert/select
I
Is there anywhere in the docs that says we should not use an
underscore in a table name?
table FC_Client_Info exists with a record where jobno 1234 has
info:
select acode from FC_Client_Info where jobno = '1234';
fails with a warning that fc_client_info does not exist
notice the lower case. I
I am away from my server for the weekend and I need a little help.
when doing updates of multiple fields there commas between
the elements?
I mean
update table set cname = 'Bill', caddress = '2nd floor' where acode =
'AVAN';
I refer to the space between 'Bill' and caddress.
if I could g
This is a rather generic question about "date" and "time". I seem to
be beating my head on the wall. I was trying to use a set up a table
with a 'date' and 'time' field. I wanted to keep the two separate.
Can someone explain if there is a difference between a time field
and a timestamp. I do
I have a table that has a 'date' column. In psql I tried to do a
select proofdate::text from openjobs where jobno = '10625';
responce: can not cast type 'date' to 'text'
Did i miss-read this section. I thought I could cast the date to text. has anyone seen
this or am I missreading the docs?
52 matches
Mail list logo