Hi folk,
i am finding something mysterious in SQL can anyone explain?
consider the SQL:
tradein_clients=# select distinct on (amount,co_name,city)
category_id,amount,co_name,city from eyp_listing
where keywordidx ## 'vegetable' and category_id=781 ;
category_id | amount | co_na
Michiel,
> And this function:
> CREATE FUNCTION add_cust() RETURNS INT4 AS ' -- SERIAL data type is really
> an INT4 (and some more).
> BEGIN
> RETURN NEW.my_key;
> END;
> ' LANGUAGE 'plpgsql';
>
> CREATE TRIGGER add_cust BEFORE INSERT ON mytable
> FOR EACH ROW EXECUTE PROCEDURE ad
To those who pointed at the SELECT currval , thanks!, I think
this is what I need instead of a trigger. So the real problem is solved I
think. However I am quite curious about the plpgsql thing, I think I may
need to use it, or may WANT to use it (performance wise... better to be as
close as po
Dan Langille wrote:
Given that I'm considering adding a new field path_name to the tree,
I can't see the ltree package will give me anything more than I can
get from like. My main reason for adding path_name was doing queries
such as:
select * from tree where path_name like '/path/to/parent
On 17 Nov 2002 at 14:51, Josh Berkus wrote:
> Dan,
>
> > My existing tree implementation reflects the files contained on disk.
> > The
> > full pathname to a particlar file is obtained from the path to the
> > parent
> > directory. I am now considering putting this information into a
> > field
do a \d tablename
for the name of the contraint.
say its $1
the do
psql> alter table drop contstraint "$1" RESTRICT;
> Does anybody could tell me how to drop a constraint on a column where no name was
>provided to
> the constraint? How does Pg name constraints?
>
> Thanks
> --
> Renê Salomão
Does anybody could tell me how to drop a constraint on a column where no name was
provided to the constraint?
How does Pg name constraints?
Thanks
--
Renê Salomão
Ibiz Tecnologia -- www.ibiz.com.br
---(end of broadcast)---
TIP 6: Have you searc
On Wed, 2002-11-20 at 15:03, Tom Lane wrote:
> Oliver Elphick <[EMAIL PROTECTED]> writes:
> > execv() is a system call to run another executable in place of the
> > current process. If the other executable is not present, or does not
> > have permissions, you will not be able to run it. Find out
Michiel,
> Maybe this should be sent to novice... I was not certain, but if it
> should, please tell me so.
No need to apologise. Novice would have been appropriate, but SQL is
OK too.
> When I do an 'INSERT INTO VALUES '
> and on the table is a serial primary key named p_key.
> As I want thi
Oliver Elphick <[EMAIL PROTECTED]> writes:
> execv() is a system call to run another executable in place of the
> current process. If the other executable is not present, or does not
> have permissions, you will not be able to run it. Find out why.
Aside from access problems for the executable i
On Wed, 2002-11-20 at 14:23, Hugh Esco wrote:
> Everything in the path is executable for others.
> That is true for:
> /usr/lib/postgresql/bin
> and for:
> /usr/bin
> where psql is located.
So can you run the executable directly?
/usr/lib/postgresql/bin/psql -d template1
-
On Wed, 2002-11-20 at 13:52, Hugh Esco wrote:
> However, when I again attempt to invoke the psql client, I get this:
> >biko:/usr/bin$ ./psql -U postgres template1
> >Could not execv /usr/lib/postgresql/bin/psql
Pay attention to the exact message and do not flounder around
aimlessly. There is no
Everything in the path is executable for others.
That is true for:
/usr/lib/postgresql/bin
and for:
/usr/bin
where psql is located.
-- Hugh
At 12:49 PM 11/20/02 +, Oliver Elphick wrote:
There is something wrong with permissions here.
You ought to be able, as _any_ user, to r
Mr. Lane:
pg_wrapper permits Others to Execute it.
biko:/usr/bin$ ls -al | grep pg_wrapper
lrwxrwxrwx1 root root 10 Oct 10 16:24 createdb -> pg_wrapper
lrwxrwxrwx1 root root 10 Oct 10 16:24 createuser ->
pg_wrapper
lrwxrwxrwx1 root root 10 O
My continued appreciation to Tom Lane,
Michael Lange, Luis Sousa and Cameron Spitzer:
Apologies for the length of this, but I've tried everything suggested and
most f this is the shell dialogues of when I did so.
At 08:40 AM 11/20/02 +0100, Michiel wrote:
That is indeed true. Also I see you do e
On Wednesday 20 Nov 2002 10:37 am, Thrasher wrote:
> No I cannot use SET TIME ZONE.
>
> SET TIME ZONE will be set by any client backend. But what I want to get
> is that DATE_TRUNC('month', ) = DATE_TRUNC('month',
> ).
Sorry, I've obviously misunderstood. Are you just looking to discard the
timez
On Wed, 2002-11-20 at 06:30, Hugh Esco wrote:
> I did this tonight
>
> dpkg --purge postgresql
> apt-get install postgresql
>
> and am now still getting the following:
>
> >biko:/usr/bin# psql -U postgres
> >No database specified
> >biko:/usr/bin# psql -U postgres template1
> >Could not execv /u
No I cannot use SET TIME ZONE.
SET TIME ZONE will be set by any client backend. But what I want to get
is that DATE_TRUNC('month', ) = DATE_TRUNC('month',
).
Richard Huxton wrote:
On Wednesday 20 Nov 2002 9:44 am, Thrasher wrote:
Hi
I do not know if it's an error, but in this query
=# sel
On Wednesday 20 Nov 2002 9:44 am, Thrasher wrote:
> Hi
>
> I do not know if it's an error, but in this query
>
> =# select date_trunc ('month', now ());
> date_trunc
>
> 2002-11-01 00:00:00+01
> (1 row)
>
> I've got the truncated date dependant to my timezone.
>
>
On Wednesday 20 November 2002 10:48, Henshall, Stuart - Design & Print wrote:
> Michiel Lange wrote:
> Trigger functions can only return type OPAQUE which isn't seen by the
> client program.
I just saw that in 7.3 the return type for triggers has changed to TRIGGER.
HTH
Johannes Lochmann
--
Title: RE: [SQL] trying to learn plpqsql... so please forgive..
Michiel Lange wrote:
> Maybe this should be sent to novice... I was not certain, but if it
> should, please tell me so.
>
> The matter at hand is this:
>
> When I do an 'INSERT INTO VALUES '
> and on the table is a serial prima
Hi
I do not know if it's an error, but in this query
=# select date_trunc ('month', now ());
date_trunc
2002-11-01 00:00:00+01
(1 row)
I'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
When I do an 'INSERT INTO VALUES '
and on the table is a serial primary key named p_key.
As I want this number to be auto-generated, but use it as a 'customer
number', I want to create this function to return the value of this
insert.
Try this:
SELECT currval();
Luis Sousa
smime.p7s
De
biko:/usr/bin# psql -U postgres
No database specified
Instead, do: su - postgres
Then do: psql template1 or psql -h template1
My pg_hba.conf temporarily reads:
local all trust
host all 127.0.0.1 255.255.255.255 trust
host template1 192.168.2.21 255.255.255.0 trust
For now, just remove
> Here are the results from reversing the arguments.
>
> >hesco@biko:~$ su postgres
> >Password:
> >postgres@biko:/home/hesco$ cd
> >postgres@biko:~$ cd /usr/bin
> >postgres@biko:/usr/bin$ psql tempate1 -U postgres
> >Could not execv /usr/lib/postgresql/bin/psql
> >postgres@biko:/usr/bin$ p
25 matches
Mail list logo