Re: [SQL] How to get all users under a group

2006-09-13 Thread Emi Lu

To answer my own question:

SELECT g.groname , u.usename AS "User name"
FROM pg_catalog.pg_user u
left join pg_catalog.pg_group g on(u.usesysid = ANY(g.grolist))
ORDER BY 1, 2;






I know \du+ can get all group info for each user.

Could someone tell me how to get all users under each group please?

such as provide the group name, showing all users under the group.

Thanks,
Emi


---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings



---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster


[SQL] Aggregates with internal state type?

2006-09-13 Thread Markus Schaber
Hi,

The PostgreSQL allows functions to define "internal" as parameter and
return types for functions, when those are not visible from SQL.

This lead me to the question whether it is possible to use "internal" as
state type for an Aggregate whose functions are implemented in C.

Thanks,
Markus

-- 
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf. | Software Development GIS

Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org

---(end of broadcast)---
TIP 6: explain analyze is your friend


Re: [SQL] Aggregates with internal state type?

2006-09-13 Thread Tom Lane
Markus Schaber <[EMAIL PROTECTED]> writes:
> This lead me to the question whether it is possible to use "internal" as
> state type for an Aggregate whose functions are implemented in C.

No, because the system has no idea what the representation of an
"internal" state value might be, and in particular how to copy it.
The same goes for other pseudotypes.

regards, tom lane

---(end of broadcast)---
TIP 1: 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] Aggregates with internal state type?

2006-09-13 Thread Markus Schaber
Hi, Tom,

Tom Lane wrote:
> Markus Schaber <[EMAIL PROTECTED]> writes:
>> This lead me to the question whether it is possible to use "internal" as
>> state type for an Aggregate whose functions are implemented in C.
> 
> No, because the system has no idea what the representation of an
> "internal" state value might be, and in particular how to copy it.
> The same goes for other pseudotypes.

Ah, I see. So there's no possibility to pass some void* kind of
intermediate data, I have to craft at least a dummy PostgreSQL datatype
for it.

This also solves the question how such things would be cleaned up in
case of an intermediate error.

Thanks,

Markus

-- 
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf. | Software Development GIS

Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org

---(end of broadcast)---
TIP 1: 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] Aggregates with internal state type?

2006-09-13 Thread Tom Lane
Markus Schaber <[EMAIL PROTECTED]> writes:
> Ah, I see. So there's no possibility to pass some void* kind of
> intermediate data, I have to craft at least a dummy PostgreSQL datatype
> for it.

Right.  My first thought would be to use bytea as the declared type ---
doesn't put much burden on you except to have a length word at the front.

regards, tom lane

---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings


Re: [SQL] Aggregates with internal state type?

2006-09-13 Thread Markus Schaber
Hi, Tom,

Tom Lane wrote:

>> Ah, I see. So there's no possibility to pass some void* kind of
>> intermediate data, I have to craft at least a dummy PostgreSQL datatype
>> for it.
> 
> Right.  My first thought would be to use bytea as the declared type ---
> doesn't put much burden on you except to have a length word at the front.

Yes, that will work for C, and I'll have a look into it. Good idea.

I had the secret hope that I'd come up with a scheme that also works
using pljava, avoiding the serialization and reserialization of java
objects. But I'm afraid that this gets more difficult.

Markus
-- 
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf. | Software Development GIS

Fight against software patents in Europe! www.ffii.org
www.nosoftwarepatents.org

---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster


[SQL] How to delete multiple records

2006-09-13 Thread Javanesevn

Dear all,

I execute this query on below:

 delete from PRODUCT
 where exists (
  select
product_id, item_id
  from PRODUCT
  where
   research_date < '2006-01-01'
)
this query deleted all records data in PRODUCT table. The subquery 
return only some records.

Tell me about other idea? and What's wrong from this query.

Best regards,

-Javanesevn

---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?

  http://www.postgresql.org/docs/faq