Re: [SQL] How to limit access only to certain records?

2012-06-22 Thread Jov
no,I think there is no such way.

what about create view for the user you want to limit,and revoke select
privilege from the base table ?

2012/6/22 Andreas 

> Hi,
>
> is there a way to limit access for some users only to certain records?
>
> e.g. there is a customer table and there are account-managers.
> Could I limit account-manager #1 so that he only can access customers only
> acording to a flag?
>
> Say I create a relation  cu_am ( customer_id, account_manager_id ).
> Could I let the database control that account-manager #1 can only see
> customers who are assigned to him in the cu_am-relation?
>
> For now I do this in the front-end but this is easily circumvented for
> anyone who has a clue and uses some other client like psql.
>
>
> Regards
> Andreas
>
> --
> Sent via pgsql-sql mailing list ([email protected])
> To make changes to your subscription:
> http://www.postgresql.org/**mailpref/pgsql-sql
>


Re: [SQL] How to right justify text in psql?

2013-05-17 Thread Jov
the column type info can be found in information_schema.column view.

jov
在 2013-5-17 下午11:27,"Brian Sherwood" 写道:

> I am running postgresql 9.2.
>
> I am assuming it would be a function of psql to right justify text, but I
> can't find any way to do this.
>
> Is there a way to right justify just one text column?
>
>
> Thanks
>
> Brian
>


Re: [SQL] function array_to_string(text[]) does not exist

2013-08-25 Thread Jov
Yes,array_to_string(text[]) does not exist.
This from the doc may help:
 array_to_string(anyarray,text [, text]) text concatenates array elements
using supplied delimiter and optional null stringarray_to_string(ARRAY[1,
2, 3, NULL, 5], ',', '*') 1,2,3,*,5

Jov
blog: http:amutu.com/blog <http://amutu.com/blog>


2013/8/25 Victor Sterpu 

>  Hello
>
> When I run :
> SELECT array_to_string(array_agg(CONCAT(CAST (ltrv1.val_min AS CHAR), '-',
> CAST(ltrv1.val_max AS CHAR), ' ', ltrv1.comentarii)))
> FROM lab_tests_reference_values ltrv1
> GROUP BY ltrv1.val_min, ltrv1.val_max, ltrv1.comentarii;
>
> I get the error:
> ERROR:  function array_to_string(text[]) does not exist
> LINE 1: SELECT array_to_string(array_agg(CONCAT(CAST (ltrv1.val_min ...
>^
> HINT:  No function matches the given name and argument types. You might
> need to add explicit type casts.
>
> I tryed to cast but it's still not working.
>
> Thanku you.
>
> *DISCLAIMER:
> Acest mesaj de posta electronica si documentele aferente sunt
> confidentiale. Este interzisa distribuirea, dezvaluirea sau orice alt mod
> de utilizare a lor. Daca nu sunteti destinatarul acestui mesaj, este
> interzis sa actionati in baza acestor informatii. Citirea, copierea,
> distribuirea, dezvaluirea sau utilizarea in alt mod a informatiei continute
> in acest mesaj constituie o incalcare a legii. Daca ati primit mesajul din
> greseala, va rugam sa il distrugeti, anuntand expeditorul de eroarea
> comisa. Intrucat nu poate fi garantat faptul ca posta electronica este un
> mod sigur si lipsit de erori de transmitere a informatiilor, este
> responsabilitatea dvs. sa va asigurati ca mesajul (inclusiv documentele
> alaturate lui) este validat si autorizat spre a fi utilizat in mediul dvs.
> *
>
>