[SQL] SQL request change when upgrade from 7.0.2 to 7.1.3

2001-09-14 Thread Richard NAGY
t WHERE sect_id = 56 and sect_id <> 3 and sect_id <> 9 and sect_id <> 1 and sect_id <> 13) ORDER BY e.type, e.nom Now, if I want that my request works well, I have to remove the order by statement. But, of course, it is not ordered any more. So how can I translate this request to one which can work with an order by statement ? Thanks. -- Richard NAGY Presenceweb  

Re: [SQL] SQL request change when upgrade from 7.0.2 to 7.1.3

2001-09-14 Thread Richard NAGY
ow, the query works well without any error. It is ordered but I think it is certainly due to the fact that the table was already ordered on disk. So, I have no more errors but I'm not sure that it is completely good. PS : The interface tool that I have used to send queries to the database was psql. Regards -- Richard NAGY Presenceweb  

Re: [SQL] SQL request change when upgrade from 7.0.2 to 7.1.3

2001-09-17 Thread Richard NAGY
Josh Berkus a écrit : Richard, I'm curious now.  What happens if you remove the table qualifications, e.g.: ORDER BY type, nom; -Josh __AGLIO DATABASE SOLUTIONS___    Josh Berkus   Complete information technology  [

Re: [SQL] SQL request change when upgrade from 7.0.2 to 7.1.3

2001-09-17 Thread Richard NAGY
Andre Schnabel a écrit : Hello Richard, I did some testing and after all your query should be ordered right. The test's I have done: Test=# select t.foo1 from testtable t Test-# union Test-# select t.foo2 from testtable t Test-# order by t.foo1; ERROR:  Relation 't' does not exis

Re: [SQL] SQL request change when upgrade from 7.0.2 to 7.1.3

2001-09-17 Thread Richard NAGY
Tom Lane a écrit : Richard NAGY <[EMAIL PROTECTED]> writes: > SELECT aes.ent_id, e.type, e.nom, aes.sect_id as voulu, > cvd_new(current_date, e.date_entree, 'new') FROM ass_entrep_sectact aes, > entreprise e WHERE e.id = aes.ent_id and aes.sect_id <> 3 and >

Re: [SQL] Tagging rows into collections?

2002-06-20 Thread Richard Huxton
ent will get a batch of numbers to use (for efficiency reasons). Be aware that I'm not 100% certain on that last sentence. - Richard Huxton ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Re: [SQL] CHECK clause doesn't work with CASE clause

2002-06-27 Thread Richard Poole
N > TRUE > WHEN ((focus <> NULL) AND (epilepsy_class IN ('g', > 'n'))) THEN FALSE > END), The condition "focus <> NULL" can't ever come out true. You probably mean IS NOT NULL. Richard

Re: [SQL] CHECK clause doesn't work with CASE clause

2002-06-27 Thread Richard Huxton
<> NULL) AND (epilepsy_class IN ('g', > It shouldn't be possible to insert a value into focus when epilepsy_class > has one of the values 'g' or 'n'. But it is. Can anyone help? Should that not be "IS NOT NULL"? - Richard Huxton -

Re: [SQL] newbie question

2002-07-08 Thread Richard Huxton
both and check the documentation for where both diverge from standards. - Richard Huxton ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] Error with DISTINCT and AS keywords

2002-07-10 Thread Richard Huxton
a date? It does strike me as a little unexpected that a quoted string doesn't default to text. - Richard Huxton ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] How do I concatenate row-wise instead of column-wise?

2002-07-16 Thread Richard Huxton
nline manual and the mailing archives (try searching on "aggregate" and "catenate" or "concat"). HTH - Richard Huxton ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly

Re: [SQL] Indexing UNIONs

2002-07-17 Thread Richard Huxton
Of course, that's just shuffling the complexity around since you'll need a view with the relevant rewrites and possibly some way of detecting scheduling conflicts? - Richard Huxton ---(end of broadcast)--- TIP 3: if posting/reading throug

Re: [SQL] Newbie: Creative use of LIMIT??

2002-07-18 Thread Richard Huxton
rilliant. The usual advice is to try to rewrite the IN as an EXISTS instead, but I'm not clear on how you'd do that in this case. Actually, looking at it, it might run a separate subquery for each row. Ideally, there'd be some way of having a "PERGROUP LIMIT" impos

Re: [SQL] convert a bigint into a timestamp

2002-07-25 Thread Richard Huxton
e (1027593096::bigint) with the name of your column. HTH - Richard Huxton ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Re: [SQL] Return Primary Key from Procedure

2002-07-25 Thread Richard Huxton
ir own "currval". Also read up on nextval and sequences. Sequences / serial type are more flexible than MySQL's AUTO_INCREMENT. You can have multiple serials in a table, and share a sequence between several tables if you want. - Richard Huxton ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] concurrent connections is worse than serialization?

2002-08-14 Thread Richard Huxton
pports postgresql serializes the queries by > simply locking when a query manipulates a PGconn object and unlocking > when it is done. (And similiarly, it creates a PGconn object on the > stack for each concurrent queries.) I assume you've ruled the application end of things ou

Re: [SQL] Explicite typecasting of functions

2002-08-14 Thread Richard Huxton
initial value of each to 1,000,000 and 99,000,000 (or whatever) and then use whichever sequence is appropriate. In the example above you'd want something like: id int not null default nextval('item_low_seq') - Richard Huxton ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

Re: [SQL] Few Queries

2002-08-14 Thread Richard Huxton
;,set_time; delete from history where complete_time <= set_time; return var_history_age_limit; END;' LANGUAGE 'plpgsql'; -- Richard Huxton ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] concurrent connections is worse than serialization?

2002-08-14 Thread Richard Huxton
On Wednesday 14 Aug 2002 3:20 pm, Wei Weng wrote: > On Wed, 2002-08-14 at 05:18, Richard Huxton wrote: > > On Tuesday 13 Aug 2002 9:39 pm, Wei Weng wrote: [30 connections is much slower than 1 connection 30 times] > > What was the limiting factor during the test? Was the CP

Re: [SQL] concurrent connections is worse than serialization?

2002-08-14 Thread Richard Huxton
ipt: pg_ins_test.pl === #!/usr/bin/perl -w my $id = shift; open CMD,"| psql -q"; my $key = "${id}AAA"; for (my $i=0; $i<100; $i++) { print CMD "INSERT INTO foo (id,name) VALUES ('$key','Test name');\n"; $key+

Re: [SQL] Explicite typecasting of functions

2002-08-15 Thread Richard Huxton
ow AFAIK pg_dump's been like that pretty much forever. Note - if you only pg_dump the table, you won't get the sequence, you need to dump the whole DB and grep away the bits you don't want. - Richard Huxton ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Re: [SQL] Character translation?

2002-09-09 Thread Richard Huxton
tname || ' ' || lastname)::varchar as expert ... If it works, could you let the list know in case anyone else needs this in future. If not, there is an ODBC list too (see postgresql.org website for details) - Richard Huxton ---(end of broadcast)--

Re: [SQL] Slow Multi-joins performance [DEVELOPERS attn please]

2002-09-09 Thread Richard Huxton
ive. If you had a genuinely complex query, the time to analyse options would be a benefit, but here I'm guessing it's not. Perhaps try it with increasing amounts of data and more restrictions and see if performance stays constant. - Richard Huxton ---(end of

Re: [SQL] Dublicates pairs in a table.

2002-09-17 Thread Richard Huxton
On Tuesday 17 Sep 2002 7:36 am, Ries van Twisk wrote: > Richard, > > do you suggest using a stored procedure to handle this? I do expect that > the table will be large (for me large is a around 1-2 records, the > table as more columns but I only need the restriction on

Re: [SQL] Returning a reference to a cursor from a function

2002-09-17 Thread Richard Huxton
On Thursday 12 Sep 2002 7:12 pm, david williams wrote: > To anyone who can help me, > > I am new at Postgresql and am having some problems. > I went a stage further attempt to put this query into a function as such > CREATE FUNCTION getallusers() RETURN integer AS' > DECLARE > Liahona CURSOR

Re: [SQL] Returning a reference to a cursor from a function

2002-09-18 Thread Richard Huxton
On Tuesday 17 Sep 2002 7:12 pm, you wrote: > Richard, > > Thanks for the information. I've made some modifications to your code here > so that it does a RAISE NOTICE in each loop returning simply the value of n > and then when the loop is finished it again returns n. > &

Re: [SQL] check source of trigger

2002-09-20 Thread Richard Huxton
rigger. There are a number of "special" variables defined if you are a trigger procedure (not just OLD and NEW) - is that what you were after (Programmers manual, ch 23.9) - Richard Huxton ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Re: [SQL]

2002-09-20 Thread Richard Huxton
something there for you. That's assuming you don't care about order of course. - Richard Huxton ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

Re: [SQL] Null not equal to '' (empty)

2002-09-27 Thread Richard Huxton
o rows. Yep - that's the way it should be. If you want empty-strings, ask for them. If you don't want to allow null values in a column define it as NOT NULL. - Richard Huxton ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

Re: [SQL] Dublicates pairs in a table.

2002-09-27 Thread Richard Huxton
nnot insert a duplicate key into unique index foo_both_uniq Function defined as: CREATE FUNCTION ord_fn (text,text) RETURNS text AS ' SELECT (CASE WHEN $1 < $2 THEN $1 || $2 ELSE $2 || $1 END) as t; ' LANGUAGE SQL WITH (iscachable); -- Richard Huxton ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Re: [SQL] Dublicates pairs in a table.

2002-09-27 Thread Richard Huxton
uote). > > > INSERT INTO test (c1,c2) VALUES('a','c'); > > > INSERT INTO test (c1,c2) VALUES('c','a'); Note Stephen Szabo's observation that I'd missed the obvious need for some separator so ('a','ab') is different f

Re: [SQL] Can Postgres cache a table in memory?

2002-10-04 Thread Richard Huxton
's interfering with your OS. Could you provide brief hardware specs, the size of the table concerned, time taken? -- Richard Huxton ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Re: [SQL] rows in order

2002-10-04 Thread Richard Huxton
t; and "tree" and you should find a clean way to model trees in SQL. -- Richard Huxton ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

Re: [SQL] Problems Formulating a SELECT

2002-10-08 Thread Richard Huxton
e_id = clone.clone_id AND read='x'; CREATE VIEW contig_y_vw AS [same but for y] SELECT config_id FROM contig_x_vw, contig_y_vw WHERE contig_x_vw.clone_id = contig_y_vw.clone.id; You don't need the views, but they make the example easier. - Richard Huxton ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Re: [SQL] Probs "compiling" a function

2002-10-08 Thread Richard Huxton
x27;B' here might be the problem - did you mean \'B\' or ''B''? It probably doesn't spot it until the end of the definition when it hits another quote on the "language" line. - Richard Huxton ---(end of br

Re: [SQL] Problems Formulating a SELECT

2002-10-08 Thread Richard Huxton
On Tuesday 08 Oct 2002 4:04 pm, Charles Hauser wrote: > Richard, > > Thanks, a followup. > > I believe this will not work (novice, so take w/ grain of salt). > > I tried the following: > > chlamy_est=> CREATE VIEW contig_x_vw AS SELECT contig_id FROM clone_co

Re: [SQL] Problems Formulating a SELECT

2002-10-09 Thread Richard Huxton
On Tuesday 08 Oct 2002 7:19 pm, Charles Hauser wrote: > Richard, > [snip] > Is there a method to remove duplicate results? For instance the query > below in part yields : SELECT DISTINCT ... is what you're after. I'd do it in the views so the join has less r

Re: [SQL] PLPGSQL errors

2002-10-09 Thread Richard Huxton
ge_priority, >message, >status >) > VALUES > ( > NEW.id, > NEW.user_id, > NEW.message_date, > NEW.message_priority, > NEW.message, > NEW.status > ); > END; > ' LANGUAGE

Re: [SQL] triggers

2002-10-11 Thread Richard Huxton
helper" process that sits there LISTENing for a NOTICE and then calls the external program as required. Cleaner and means the other program doesn't have any direct connection to the Postgresql backend. - Richard Huxton ---(end of broadcast)---

Re: [SQL] Stored procedure returning row or resultset

2002-10-14 Thread Richard Huxton
nly call the function once for each parameter-set. Only works for functions like: square_root(number) and not next_random_number() -- Richard Huxton ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate su

Re: [SQL] Slow performance on MAX(primary_key)

2002-10-15 Thread Richard Huxton
rity. There is a todo list on the developers' side of the website which has a list of changes in upcoming releases, you could check there for details. -- Richard Huxton ---(end of broadcast)--- TIP 2: you can get off all list

Re: [SQL] Stored procedure returning row or resultset

2002-10-15 Thread Richard Huxton
On Monday 14 Oct 2002 6:17 pm, Tom Lane wrote: > Richard Huxton <[EMAIL PROTECTED]> writes: > > Have you looked at marking f1() etc cachable? This means Postgresql > > will only call the function once for each parameter-set. > > Unfortunately that's not true at

Re: [SQL] Slow performance on MAX(primary_key)

2002-10-17 Thread Richard Huxton
it is > indexed use a similar method to the suggested > SQL work around? > > Can I help this to happen? Subscribe to pgsql-hackers and talk through a proposed hack there. The developers always seem happy to receive contributions (you've just got to look at the contrib folde

Re: [SQL] object oriented vs relational DB

2002-10-17 Thread Richard Huxton
quot;constantly evolving categories" for filing its books? Anyway Charles, I agree with Josh's comments and just thought I'd point you at the following site that has plenty of discussion on relational vs object - oriented database systems. http://www.dbdebunk.com/ -- Richard

Re: [SQL] Row Locking?

2002-10-22 Thread Richard Huxton
g threads. Might be worth checking the archives for this list and pgsql-general - someone had a similar question a few weeks/months ago. -- Richard Huxton ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Re: [SQL] How do you write this query?

2002-10-31 Thread Richard Huxton
2 FROM test t2 WHERE t2.data1='pooh') You can probably get away without the t1/t2 stuff but that should make things clear. Since Postgresql isn't very good at optimising IN, you might want to rewrite it as an EXISTS query instead - see the manuals and mailing list archives f

Re: [SQL] FIFO Queue Problems

2002-11-01 Thread Richard Huxton
someone suggest a better FIFO queue method? Check out SELECT FOR UPDATE - this locks the row and should do what you want. This means that 1 time in 1000 your query will fail and need to be retried. HTH -- Richard Huxton ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

Re: [SQL] owner of type 'mmm' apperars to be invalid

2002-11-05 Thread Richard Huxton
7;d recommend you add a user with the required id, then dump the database and fix the dump as required. The owner of "refcursor" should be postgres (or whatever the system user is called) - if that user has been deleted, I'd be surprised that's the only errors you get. -- Ri

Re: [SQL] owner of type 'mmm' apperars to be invalid

2002-11-05 Thread Richard Huxton
#x27;d be nervous about it. If you create a new database does it contain the refcursor type? If so, drop and recreate the database, restoring the data to it. If not, I think you'll need to restore the template1 db - there's an article on techdocs.postgresql.org about this (byJosh IIRC)

Re: [SQL] owner of type 'mmm' apperars to be invalid

2002-11-05 Thread Richard Huxton
Episode 1 by Josh Berkus" at http://techdocs.postgresql.org/ Loads of other good stuff there too. Might not be necessary though - if the template1 db contains the refcursor type definition then you just need to drop and recreate the problem database. -- Richard Huxton ---

Re: FW: [SQL] query optimization question

2002-11-06 Thread Richard Huxton
u not define a function age_range(date) to return the relevant range text, then group on that text? I've used that before. -- Richard Huxton ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

Re: [SQL] Generating a cross tab (pivot table)

2002-11-07 Thread Richard Huxton
e/ > I've translated it and think it's useful for many who subscribed > (I hope so, maybe it was told before, but I couldn't find > anything about this topic in the techdecs). Very useful. Also note there are some examples of how to produce crosstab results in the tabl

Re: [SQL] PLpgSQL FOR IN EXECUTE question

2002-11-07 Thread Richard Huxton
> > LOOP > list := list || '', '' || this_record.$1 ; > END LOOP; > > As expected, accessing a field via this_record.$1 > does not work. > Can it be done otherwise? Perhaps "SELECT ... AS known_name FROM ..." and then this_record.known_n

Re: [SQL]

2002-11-12 Thread Richard Huxton
rsion of the manual but there are definitely examples in the contrib/ directory of the source download (of 7.3). I seem to remember an example in the mailing lists too, so perhaps a check of the archives would be worthwhile. -- Richard Huxton ---(end of broadcast)--

Re: [SQL] Does Postgres replace \\ with \ in an update query

2002-11-15 Thread Richard Huxton
character is used to escape other characters from normal interpretation, so you can have a text value: 'Richard\'s text' which means during processing the backslash is removed. If you want to actually have a backslash in your sql you'll need to escape it too. So you'

Re: [SQL] index usage for query

2002-11-19 Thread Richard Huxton
ement_portno on port_s s (cost=0.00..7.38 rows=1 width=42) -> > Sort (cost=1.27..1.27 rows=10 width=48) > -> Seq Scan on port_s_p p (cost=0.00..1.10 rows=10 width=48) Here you only have one join in two parts "port po" - "port_s s" and then

Re: [SQL] Date trunc in UTC

2002-11-20 Thread Richard Huxton
27;ve got the truncated date dependant to my timezone. > > Instead, I would like to have as a result > > 2002-11-01 01:00:00+01 > > which is correct, but I cannot set the whole server to UTC. Any way to > get this ? Perhaps SET TIME ZONE is what you want. See

Re: [SQL] Date trunc in UTC

2002-11-20 Thread Richard Huxton
)); > >>date_trunc > >> > >> 2002-11-01 00:00:00+01 > >>Instead, I would like to have as a result > >> > >> 2002-11-01 01:00:00+01 > >> > >>which is correct, but I cannot set the whole server t

Re: [SQL] Date trunc in UTC

2002-11-21 Thread Richard Huxton
On Wednesday 20 Nov 2002 3:40 pm, Juan Fernandez wrote: > Hi Richard > > Ok, I'll do my best to explain clearer ;) I'll do my best to be of some use ;-) > I have to make some monthly reports about some service requests > activity. So, I'm keeping in a table the mont

Re: [SQL] Are sub-select error suppressed?

2002-11-26 Thread Richard Huxton
b_title_selection to use tsel_id rather than title_id this will be clearer. You can get the same with ranking: DELETE FROM ttab_title_selection WHERE ranking IN (SELECT ranking FROM tview_title); I'm guessing it gets parsed down to: DELETE FROM ttab_title_selection WHERE ranking IN (ranking); which of course

Re: [SQL] PL/SQL trouble

2002-11-26 Thread Richard Huxton
) = 0 then 6 else (extract(DOW from $1) - 1 ) end ) ); If you put your function in a text file and create it with psql -f you can pinpoint errors more easily. In this case, the $2 was complaining about the second (expected) paramater to to_date I think. -- Richard

Re: [SQL] Two TIMESTAMPs in one pl/sql function

2002-11-26 Thread Richard Huxton
and timer2 TIMESTAMPs are always identical. Try timeofday() not now(). Quite often you want the time to stay fixed for the length of a transaction (what now() does). In this case you don't - see the Functions : date/time section of the manual for details. -- Richar

Re: [SQL] help on sql query

2002-11-26 Thread Richard Huxton
ELECT A, B FROM T WHERE A IN (SELECT MAX(A) FROM T) > > What do yo think of the queries above? And give me the better > implementation if possible. If you have an index on A the first option will be faster. All PG has to do in this case is check the end of the index and fetch one row. -- R

Re: [SQL] SQL -select count-

2002-11-26 Thread Richard Huxton
On Tuesday 19 Nov 2002 5:06 pm, Giannis wrote: > when I do : > > select count(column_name) from table_name > > should I get the count for all columns or just those which are not null? Just "not null" - use count(*) or count(0) for a count of ro

Re: [SQL] How does postgres handle non literal string values

2002-11-26 Thread Richard Huxton
ot; + sql_escaped(username) + "')..." You *will* want to escape the username and password otherwise I'll be able to come along and insert any values I like into your database. I can't believe the JDBC classes don't provide 1. Some way to escape value strings 2.

Re: [SQL] Function and insert

2002-11-27 Thread Richard Huxton
PG refuse to accept the type returns oid as the function is not a SELECT. > What can I do ? You're not returning anything - try something like: CREATE FUNCTION foo_ins(int4) RETURNS int4 AS 'INSERT INTO foo VALUES($1); SELECT $1;' LANGUAGE 'SQL'; -- Richard Huxton -

Re: [SQL] Analyze + Index

2002-11-29 Thread Richard Huxton
If you had 3000 users and batch inserted 1000 users you'd probably want to ANALYSE. -- Richard Huxton ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/users-lounge/docs/faq.html

Re: [SQL] master-detail relationship and count

2002-11-29 Thread Richard Huxton
e l.lktype = > 'R' and l.lklid = r.rtid; You'll want to GROUP BY SELECT r.rtid, r.rtname, l.count(*) FROM route r, links l WHERE l.lktype='R' AND l.lklid=r.rtid GROUP BY r.rtid, r.rtname; -- Richard Huxton ---(end of broadcast)-

Re: [SQL] Need Postgresql Help

2002-12-02 Thread Richard Huxton
> You need 7.3 to do 3). > Infor on stored procedures: > $INSTALLDIR/doc/html/plpgsql.html 1. See the manual chapter on "procedural languages" - plpgsql, pltcl, plperl Also see http://techdocs.postgresql.org 2. Exactly as with any other query 3. Either upgrade to 7

Re: [SQL] Regarding boolean datatype

2002-12-05 Thread Richard Huxton
://www.postgresql.org/ Extra info at http://techdocs.postgresql.org/ (including some online books) Mailing lists you know about. -- Richard Huxton ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

Re: [SQL] Case-insensitive

2002-12-06 Thread Richard Huxton
A very common approach is to use PG's functional indexes: SELECT * FROM foo WHERE lower(foo_col) LIKE 'blah%'; along with CREATE INDEX foo_lwr_col ON foo (lower(foo_col)); -- Richard Huxton ---(end of broadcast)--- TIP 3: if

Re: [SQL] Rules/Trigges Trade-offs

2002-12-06 Thread Richard Huxton
ed for every row. -- Richard Huxton ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] sql

2002-12-09 Thread Richard Huxton
3 3 | 2002-01-01 3 | 2002-02-02 3 | 2002-03-03 (6 rows) -- Richard Huxton ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] Default Permissions (repost from Novice)

2002-12-09 Thread Richard Huxton
in the last week or so. See my PostgreSQL Notes linked to from http://techdocs.postgresql.org -- Richard Huxton ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] Adding foreign key constraint post table creation

2002-12-11 Thread Richard Huxton
;not null'. Othere than > generating INSERT stmts for the data how else could I enter the data? You could process the file with perl/awk etc. and add the required timestamps. I don't think COPY substitutes default values for you. -- Richard Huxton ---

Re: [SQL] order by and aggregate

2003-01-06 Thread Richard Huxton
te some_table.some_field must be GROUPed or used in an > aggregate function The "order by" isn't necessarily handled before calculating maxsum() anyway. -- Richard Huxton ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org

[SQL] to_date() confusion

2003-01-08 Thread Richard Rowell
lect to_date(to_char(10102,'00'),'MMDDYY'); to_date 2010-01-10 (1 row) TIA! -- Richard Rowell <[EMAIL PROTECTED]> ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an

[SQL] to_date confusion

2003-01-13 Thread Richard Rowell
I'm confused. How do I get the integer 10102 to come in as the date 2002-01-01? cmi=> select to_date('010102','MMDDYY'); to_date 2002-01-01 (1 row) cmi=> select to_char(10102,'00'); to_char - 010102 (1 row) cmi=> select to_date(to_char(10102,'00'),'MMDDYY'

Re: [SQL] efficient count/join query

2003-02-07 Thread Richard Huxton
nt FROM history; SELECT sid,jid,SUM(all_count) FROM all_counts GROUP BY sid,jid; -- Richard Huxton ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly

Re: [SQL] conversi ms-sql7 vs postgresql 7.3

2003-02-07 Thread Richard Huxton
he sequence and also needs special logic to handle id=1 (or whatever the smallest "id" is). HTH -- Richard Huxton ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] Special characters in SQL queries

2003-03-12 Thread Richard Huxton
look at the code for the C function - it should be fairly obvious what characters it's working on. If you do want to write your own, it's best not to strip certain characters, but rather to list those you will allow through. That way if you miss something it's

Re: [SQL] View - Join based on dis-similar data types

2003-03-14 Thread Richard Huxton
ds, however, adding a WHERE > > clause produces no output. Can you please provide a real example, otherwise we're just guessing. Are you sure you've not forgotten about the spaces padding your char(50) field? -- Richard Huxton ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] Deleting large object from table pg_largeobject

2003-03-14 Thread Richard Huxton
e Java, but there's a class mentioned in the manual : Client Interfaces : JDBC : extensions. With psql you probably want \lo_unlink HTH -- Richard Huxton ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Re: [SQL] simulating partial fkeys.. [ATTN Developers please]

2003-06-06 Thread Richard Huxton
nd who could comment how plausible this would be? -- Richard HuxtonA Brief Real-world Trigger Example Created 2003-03-13 by Richard Huxton ([EMAIL PROTECTED]) Version: First Draft - treat with caution This is a real-world example, showing how you can use the plpgsql procedural language to buil

Re: [SQL] little doubt

2003-05-27 Thread Richard Huxton
ing back yourself - there's always someone who knows less than you. Especially if you have time to scan for unanswered questions that are a day or two old. Even if all you can do is help someone rephrase their question, that's useful. HTH -- Richard Huxton --

Re: [SQL] [PHP] faster output from php and postgres

2003-05-27 Thread Richard Huxton
aggregate function, like SUM() but for text. Don't worry, it's not difficult. The only issue is that you won't be able to guarantee the order of authors in the field. There might be something on this in my PostgreSQL Notes on http://techdocs.postgresql.o

Re: [SQL] please helpme ?

2003-05-30 Thread Richard Huxton
hat you might want to consider the use of varchar() rather than char() types - char() is space padded and there is no speed impact on PG. -- Richard Huxton ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriat

Re: [SQL] CASE returning multiple values (was SQL Help)

2003-05-31 Thread Richard Huxton
hat it is you're trying to acheive - real fields/schemas etc? -- Richard Huxton ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Re: [SQL] CASE returning multiple values (was SQL Help)

2003-06-02 Thread Richard Huxton
_cond" to say whether to show it or not. Now, it depends how complicated your conditions can be as to how complicated the setup of these tables is and also how complicated the query-builder can be. However, I have used something similar to build queries myself and it does

Re: [SQL] Maintaining a counter up-to-date

2003-06-03 Thread Richard Huxton
ame > "catid", I only got an increment or decrement by one of the counter. You want to use triggers not rules here (see the "server programming" and "procedural language" manual sections). A trigger will be fired for each row inserted/

Re: [SQL] Retype

2003-06-10 Thread Richard Huxton
ard but long-winded CAST function -- Richard Huxton ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Re: [SQL] Our FLOAT(p) precision does not conform to spec

2003-06-16 Thread Richard Hall
Fix the problem and inform the users about code that may break. Rick ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] is this possible in plpgsql ?

2003-06-19 Thread Richard Huxton
t||'''') THEN > raise notice ''yep''; Try something like: query:=''SELECT 3 in ('' || txt || '')'' EXECUTE query; Then check the result for true/false -- Richard Huxton ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly

Re: [SQL] virtual table

2003-06-23 Thread Richard Huxton
- means it won't contain any columns nor data, but trigger doing > all the job. Look into views - you'll need to provide triggers to handle the update/inserts. -- Richard Huxton ---(end of broadcast)--- TIP 8: explain analyze is your friend

Re: [SQL] virtual table

2003-06-23 Thread Richard Huxton
On Monday 23 Jun 2003 9:39 am, Tomasz Myrta wrote: > Dnia 2003-06-23 10:29, Użytkownik Richard Huxton napisał: > > Look into views - you'll need to provide triggers to handle the > > update/inserts. > > I think view won't change too much - there is not too much dif

Re: [SQL] Urgent Help : Use of return from function/procedure.

2003-06-23 Thread Richard Huxton
Short answer - you don't. I'm not sure why you want to do this - if you just inserted the new values, surely you know what they are? There was something very similar to this last week, I'd have a look in the mailing-list archives at http://archives.postgresql.o

Re: [SQL] virtual table

2003-06-23 Thread Richard Huxton
On Monday 23 Jun 2003 10:09 am, Tomasz Myrta wrote: > Dnia 2003-06-23 10:54, Użytkownik Richard Huxton napisał: > > Hmm - I think your problem is going to come before that. Any time you do > > an INSERT, PostgreSQL is going to need to know the types of all the > > columns

Re: [SQL] multi-table unique index

2003-06-23 Thread Richard Huxton
e_id int not null references foo_types, ... PRIMARY KEY (foo_id,foo_type_id) ); CREATE TABLE foo_1 ( extra_foo int4 not null, extra_type int4 not null extra1 text, PRIMARY KEY (extra_foo, extra_type) CONSTRAINT link_to_foo FOREIGN KEY (extra_foo,e

Re: [SQL] Join or Where?

2003-06-26 Thread Richard Huxton
antity, 4 >(select quantity/getupquantity) as getup 5 > from t_stockchanges, t_products 6 > where (getupquantity<>0) 7 > limit 30; I don't think the t_products in the first line is the same as that in the fifth line - that'd surely mess up your values. --

Re: [SQL] create view error

2003-07-07 Thread Richard Huxton
On Monday 07 Jul 2003 12:40 pm, Gary Stainburn wrote: > left outer join > (select lnumber from lnumbers) ln on ln.lnid = l.lid and ^^^ ^^^ > ERROR: No such attribute or function ln.lnid Is is this? -- Richa

<    1   2   3   4   5   6   7   8   9   10   >