[SQL] PL/pgSQL and PHP 5

2006-08-09 Thread PostgreSQL Admin
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

Re: [SQL] [PHP] PL/pgSQL and PHP 5

2006-08-09 Thread PostgreSQL Admin
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

Re: [SQL] PL/pgSQL and PHP 5

2006-08-09 Thread PostgreSQL Admin
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

Re: [SQL] PL/pgSQL and PHP 5 - thanks

2006-08-09 Thread PostgreSQL Admin
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

[SQL] Replace string

2007-04-11 Thread PostgreSQL Admin
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

Re: [SQL] Replace string

2007-04-12 Thread PostgreSQL Admin
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:]]', ''), ' ',

[SQL] Add constraint for number of chars

2007-04-25 Thread PostgreSQL Admin
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

[SQL] pgmemcache

2007-07-18 Thread PostgreSQL Admin
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

[SQL] Constraints for grouping

2007-09-03 Thread PostgreSQL Admin
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

Re: [SQL] Constraints for grouping

2007-09-03 Thread PostgreSQL Admin
> --- 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

[SQL] Trigger to change different row in same table

2007-09-04 Thread PostgreSQL Admin
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

Re: [SQL] Trigger to change different row in same table

2007-09-04 Thread PostgreSQL Admin
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

[SQL] Foreign Key for multi PK or design question

2007-12-11 Thread PostgreSQL Admin
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)

Re: [SQL] Foreign Key for multi PK or design question

2007-12-11 Thread PostgreSQL Admin
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

Re: [SQL] Foreign Key for multi PK or design question

2007-12-11 Thread PostgreSQL Admin
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

[SQL] Unclosed connections

2008-01-25 Thread PostgreSQL Admin
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

[SQL] Double query

2008-02-06 Thread PostgreSQL Admin
Simple question - but my brain is not working: This is my table Column | Type | Modifiers ---++- id| integer

[SQL] DB Design

2008-03-14 Thread PostgreSQL Admin
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

[SQL] Different type of query

2008-06-11 Thread PostgreSQL Admin
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

Re: [SQL] Different type of query

2008-06-11 Thread PostgreSQL Admin
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

Re: [SQL] Different type of query

2008-06-11 Thread PostgreSQL Admin
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

[SQL] Tsearch

2008-06-12 Thread PostgreSQL Admin
this is a small sample of the data: short_desc | long_desc --+---

[SQL] Design and Question

2008-07-10 Thread PostgreSQL Admin
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