Why would one need a Primary Key... which can only be declared at table creation if
one can create a Unique Index post table creation?
ie: I deleted my primary key... is that a big deal? What's the purpose of the Primary
Key if it's function can be duplicated with another Unique Index?
thanks,
hi all,
Is it possible to use arrays of any datatypes in plpgsql function?
If yes, how??
thankx.
==
Every absurdity has a champion who will defend it.
===
On Mon, 20 Aug 2001, Joseph Shraibman wrote:
> I want to select a boolean if there exists a row in another table that matches this
>one.
> So I did select ..., (select count(*) from table2 where ...) > 0 ...
> but that count(*) was taking forever. I know there is a better way to do it, but
>
I'm using V6.5.3.
Is there a way to move the database to another directory location
instead in /var/lib/pgsql? As this is on the root file system on the
server and it's using to much spaces.
---(end of broadcast)---
TIP 6: Have you searched our lis
I want to select a boolean if there exists a row in another table that matches this
one.
So I did select ..., (select count(*) from table2 where ...) > 0 ...
but that count(*) was taking forever. I know there is a better way to do it, but
whenever
I try to use EXISTS I get a syntax error. Wh
Folks,
Ooops! Let me correct that example:
UPDATE invoice SET invoice_total = total_of_items
FROM (SELECT invoice_id, sum(item_amount) AS total_of_items
FROM invoice_items) iit
WHERE iit.invoice_id = invoices.id;
Sorry to lead people astray.
-Josh
__AGLIO DATABASE SOLUTIONS___
Hi all,
My c is rusty and you are all pros!...so...
I want to write a server routine that will return a string so that when "SELECT
retstr() from tbl;" is executed this string is returned.
What's the best way to do this?
i.e.
create:
CREATE FUNCTION retstr() RETURNS char???
AS '/tmp/tst.
Robby,
> Do you know if, internally there's any difference between
>
> UPDATE A,B SET a.f1 = b.f1 WHERE a.i = b.i;
>
> -and-
>
> UPDATE A SET a.f1 = b.f2 FROM B WHERE a.i = b.i;
>
> Just wondering why the SQL standard would be broken in this
> case---and if there's any reason to learn this
hi ,
Is there any split or explode function which split a whole string to
seperate parts using any special delimiter ?
TIA
Omid
_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
-
Christophe Labouisse writes:
> /usr/local/bin/pg_ctl start -s -w -l /usr/local/pgsql/errlog -o "-i"
Don't use the -w option. Read the man page.
--
Peter Eisentraut [EMAIL PROTECTED] http://funkturm.homeip.net/~peter
---(end of broadcast)--
Select id from T where name = 'bleh'
UNION ALL
Select id from T where description = 'bleh';
Will get you the resultset you want, but: I don't believe that you can do a
GROUP BY on it.
If you just want counts, as you describe below, you could do something like:
SELECT 'Only One', (SELECT count (i
you can't.
rjsjr
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of Joseph Syjuco
> Sent: Tuesday, August 14, 2001 10:34 PM
> To: [EMAIL PROTECTED]
> Subject: [SQL] user defined function question
>
>
> how do i return a resultset from a user defined
Robby,
> There's no FROM clause in an update statement. And second, you
> need to be careful to make sure all your tokens make sense. You
> had an extra "B" in the middle of your statement. Based on this:
Actually, Postgres *does* support UPDATE ... FROM. I use it quite a
bit. The syntax can b
Joseph,
> how do i return a resultset from a user defined function. pls show a
> simple
> structure
As of version 7.1.x, you cannot return rowsets from a function. This
feature will be available for future versions.
A number of workarounds have been posted to the list in past months.
Browse th
Well, a short answerto your direct question would be:
Select id from T where name = 'bleh'
UNION ALL
Select id from T where description = 'bleh';
But since you described what your trying to do, not just how
your trying to do it, doesn't this do it for you?
SELECT id from T where name =
On Mon, 20 Aug 2001, Jean-Christophe Boggio wrote:
> Hello, can someone explain to me why this query is so slow :
>
> select distinct t.idmembre,p.datecrea
> from tmp_stat t,prefs p
> where p.idmembre=t.idmembre
> limit 5;
>
> And this one is so fast :
>
> select t.idmembre,p.datecrea
> fr
I would like execute a system command or my program or my shell
script in procedure. How do I do that?
For example,
CREATE FUNCTION myname() RETURN OPAQUE AS '
BEGIN
IF count(NEW.aColumn) >= 600
THEN RAISE EXCEPTION ''Hello, it is time to re-index the
table.'';
END IF;
> Is there any way to find out what constraints have been set on a table
> or on columns in a table?
Take a look at the source for psql.
--
johs
---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster
I think this is because if you remove duplicates before joining the tables,
then you would join smaller tables, therefore cutting the cost of the join
(and later sorting and removing duplicates).
Say tmp_stat has the size of 1000 and 10 duplicates on the everage for each
distinct tuple. Also, if t
I don't knoe, may be I don't understand the question, but for me its
looking like UNION statement. For example:
select id from T where name='bleh'
UNION
select id from T where description='bleh';
Aug 14, 20:40 -0400, Mark Mikulec wrote:
> Hello,
>
> At first I thought what I was trying to do wa
Fredrik,
Just for future reference, it's generally a good idea to include a complete
table schema
and some sample data for your tables when asking this kind of question. But
I think I know
what you mean and will try to help you.
>Suppose I have Table A looking something like this:
>IndexText
Fredrik,
> I have a very simple sql-question from an sql-beginner:
Sure. Keep in mind that there is a pgsql-newbie list. Also quite a few
good books on the topic, including: Database Design for Mere Mortals and
SQL for Smarties.
> Then I want to change all occurences of NrA in Table A to NrB.
Title: RE: [SQL] Simple SQL-syntax
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Probably something like:
UPDATE tableA SET tableA.nrA = (SELECT B.nrB FROM tableB B WHERE
tableA.nrA = B.nrA);
Let me know...
MikeA
- -Original Message-
From: Fredrik Thunberg [mailto:[EMAI
Is there any way to find out what constraints have been set on a table
or on columns in a table?
--
Stephen Patterson http://home.freeuk.net/s.patterson/
[EMAIL PROTECTED] (remove spam to reply)
ICBM address 54-22-0N 0-28-0W
---(end of broadcast)-
Mark,
> What i'd like to do is the following:
>
> Select id from T where name = 'bleh';
>
> and
>
> Select id from T where description = 'bleh';
>
> and result both results in the same result set. That is, duplicate
> id's
> if they appear. So then I could do a GROUP BY and a COUNT to see how
>Hello,
>At first I thought what I was trying to do was simple and could be done
>easily - but alas, I've spent way too much time and could not figure out
>how to get the results in question.
I think there's cause for excitement, because unless I'm interpreting you
incorrectly, it IS easy to do
Jayson,
> I am using Postgres 7.1.2 under linux with the JDBC drivers and Iam
> trying
> to do an insert into a text field with about a 9K string of text.
> Does
> anyone know why I would be getting an error back that says "The SQL
> Statement is too long?
You need to post this question on the p
UPDATE TableA SET nrA = TableB.nrB WHERE nrA =
TableB.nrA;
UPDATE statements don't take FROM
clauses. I don't think they like aliasing, either.
- Original Message -
From:
Fredrik
Thunberg
To: [EMAIL PROTECTED]
Sent: Monday, August 20, 2001 6:15
AM
Subject: Sim
how do i return a resultset from a user defined function. pls show a simple
structure
---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])
On Fri, Aug 17, 2001 at 03:29:36AM -0400, Morgan Curley wrote:
> Hey everyone,
> On average, are multiple simple queries better performance-wise than joins?
> i.e.
> select A.col1 from table1 A
> select B.col2 from table2 B where B.col1 = A.col1
> etc
>
> vs
>
> select A.col1, B.col2 from table1
[EMAIL PROTECTED] (Tom Lane) wrote in message news:<[EMAIL PROTECTED]>...
> <[EMAIL PROTECTED]> writes:
> > FATAL 1: configuration file `postgresql.conf' has wrong permissions
>
> > One thing to note is that before I rebooted linux I did this:
> > chmod 755 -R /usr/local/pgsql
>
> That was a b
Hello, can someone explain to me why this query is so slow :
select distinct t.idmembre,p.datecrea
from tmp_stat t,prefs p
where p.idmembre=t.idmembre
limit 5;
And this one is so fast :
select t.idmembre,p.datecrea
from (select distinct idmembre from tmp_stat) as t,
prefs p
where
I am using Postgres 7.1.2 under linux with the JDBC drivers and Iam trying
to do an insert into a text field with about a 9K string of text. Does
anyone know why I would be getting an error back that says "The SQL
Statement is too long?
At first I though it was because I was creating the SQL stat
Hello,
At first I thought what I was trying to do was simple and could be done
easily - but alas, I've spent way too much time and could not figure out
how to get the results in question.
Let's say I have a table T comprised of id of type integer, name and
description both of type text.
What i
Paul McGarry <[EMAIL PROTECTED]> writes:
> Can I avoid having the temp table written to disk
Not at present --- temp tables are not different from real tables,
except for some naming shenanigans. So creation of a temp table will
involve some disk hits.
Do you really *need* a temp table, as oppo
When restarting postgres this morning I notice the pg_ctl start hangs
forever while the database seems to be up and working. Eventually I
found out that the start process involves a "psql -l" which waits
for me to enter a password since I have "local all password" in my
pg_hba.conf. I change back
Hello.
I have a very simple sql-question from an
sql-beginner:
Suppose I have Table A looking something like
this:
Index Text
NrA
And Table B like this:
NrA NrB
Then I want to change all occurences of NrA in
Table A to NrB...
I've tried:
UPDATE tableA Set tableA.nrA
37 matches
Mail list logo