[SQL] problem with casting

2001-02-14 Thread postgresql
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?

[SQL] problem with dates

2001-02-22 Thread postgresql
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

[SQL] syntax prob

2001-02-23 Thread postgresql
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

[SQL] underscore problem

2001-02-27 Thread postgresql
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

[SQL] serial type question

2001-03-19 Thread postgresql
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

[SQL] creating "job numbers"

2001-03-22 Thread postgresql
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

Re: [SQL] creating "job numbers"

2001-03-23 Thread postgresql
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

RE: [SQL] creating "job numbers"

2001-03-23 Thread postgresql
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" >

Re: [SQL] serial type; race conditions

2001-03-29 Thread postgresql
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

Re: [SQL] serial type; race conditions

2001-04-03 Thread postgresql
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

[SQL] has anyone tried running in MAC OS X

2001-05-17 Thread postgresql
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

[SQL] ports in use question

2001-05-24 Thread postgresql
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

[SQL] cascading delete - recursivity

2001-06-12 Thread Postgresql
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

[SQL] need help please on triggers..

2001-06-12 Thread Postgresql
Hi, How to create a foreign key in postgresql ? need triggers ? Thanks, Fred ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

[SQL] calling user defined function with parameters..

2001-06-16 Thread Postgresql
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 -

[SQL] finding current oid

2001-07-06 Thread postgresql
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

[SQL] problem connecting to pg.

2001-08-14 Thread postgresql
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

[SQL] just checking

2001-08-22 Thread postgresql
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

Re: [SQL]

2001-09-08 Thread postgresql
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

[SQL] serial data type

2001-10-26 Thread postgresql
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?

Re: [SQL] more information on JOINs

2001-09-22 Thread postgresql
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

[SQL] more information on JOINs

2001-09-22 Thread postgresql
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

[SQL]

2001-10-03 Thread postgresql
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

[SQL] Table Copy.

2002-09-19 Thread PostgreSQL Server
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

[SQL] DATE TIME INDEX ?

2002-11-16 Thread PostgreSQL Server
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

[SQL] INDEX PROBLEMS ?

2002-11-16 Thread PostgreSQL Server
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

[SQL] Trigger calling a function HELP ME!

2004-04-21 Thread abief_ag_-postgresql
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,

[SQL] Trigger calling a function HELP ME! (2)

2004-04-21 Thread abief_ag_-postgresql
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

[SQL] Bug#960: WAS: Trigger calling a function HELP ME! (2)

2004-04-22 Thread abief_ag_-postgresql
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

[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