[SQL] Different plan for one query problem

2010-10-26 Thread Tatarnikov Alexander
idth=0) Index Cond: ((organization_id)::text = '12'::text) -> Index Scan using register_pkey on tbl_register (cost=0.00..8.18 rows=1 width=35) Index Cond: (tbl_register.register_id = tbl_inventory.register_id) "-> Index Scan using table3_pkey on ""fileObjects"" (cost=0.00..0.28 rows=1 width=32)" " Index Cond: (""fileObjects"".""objectId"" = tbl_rights.object_id)" " -> Index Scan using ""invFiles_new_pkey"" on ""invFiles"" (cost=0.00..0.30 rows=1 width=16)" "Index Cond: (""invFiles"".id = ""fileObjects"".""fileId"")" "Filter: ((""invFiles"".""placeStore"")::text = '12'::text)" -> Index Scan using lnk_owners_right_id_key on lnk_owners (cost=0.00..0.41 rows=1 width=32) Index Cond: (lnk_owners.right_id = tbl_rights.right_id) -> Index Scan using powners_pkey on tbl_powners (cost=0.00..0.50 rows=1 width=75) Index Cond: (tbl_powners.powners_id = lnk_owners.powners_id) -> Index Scan using objects_main_pkey1 on tbl_objects_main (cost=0.00..1.38 rows=1 width=36) Index Cond: (tbl_objects_main.object_id = tbl_rights.object_id) -> Index Scan using tbl_position_idx on tbl_position (cost=0.00..8.28 rows=1 width=21) Index Cond: (tbl_position.object_id = tbl_objects_main.object_id) -> Seq Scan on tbl_location (cost=0.00..22516.85 rows=464985 width=356) " -> Index Scan using ""kladrCache_pkey"" on ""kladrCache"" (cost=0.00..0.28 rows=1 width=104)" "Index Cond: ((""kladrCache"".code)::text = (tbl_location.kladr_id)::text)" What caused changing plan? Can i force to use one (first in expamples) plan for any values in where clause? Thanks -- -- Regards, Tatarnikov Alexander

Re: [SQL] Use "CREATE USER" in plpgsql function - Found word(s) list error in the Text body

2010-09-15 Thread Tatarnikov Alexander
> *From:* Asko Oja [mailto:asc...@gmail.com] > *Sent:* Wednesday, September 15, 2010 2:29 PM > *To:* Igor Neyman > *Cc:* Tatarnikov Alexander; pgsql-sql@postgresql.org > *Subject:* Re: [SQL] Use "CREATE USER" in plpgsql function - Found word(s) >

[SQL] Use "CREATE USER" in plpgsql function

2010-09-14 Thread Tatarnikov Alexander
Hello! I have function wich check user credentials and if test passed function must create new user with generated username and password. Language is plpgsql. For example: DECLARE creds RECORD; ... SELECT * INTO creds FROM ... creds is Record with fields userName(VARCHAR) and userPassword