[GENERAL] GENERAL : [Can somebody explain about Base directory]
Hello All, Base directory is consuming to much memory, leading to no space on server and stopping the application Somebody please explain why it takes so much memory and is it safe to delete those files.? -- Regards : Venktesh Guttedar.
[GENERAL] GENERAL - [How to check if the array contains the element.]
Hello All, How do i check if any one element of one array exists in another array. Eg: array1 = [1,2,3,4] array2 = [1,4,5,7] Now i expect the result as true even if any one element matches from array2 in array1. Any help would be appreciated. Thank you. -- Regards : Venktesh Guttedar.
Re: [GENERAL] Appending to multidimentional array.
Hello Chris Travers. Its working. You saved my day.:) Thanks a tons. On Tue, Dec 13, 2016 at 9:18 AM, Chris Travers <chris.trav...@gmail.com> wrote: > Array_1 :== Array_1 || Array[Array_2] > > I think > > On Tue, Dec 13, 2016 at 6:08 AM, VENKTESH GUTTEDAR < > venkteshgutte...@gmail.com> wrote: > >> Hello, >> >> Is there a way to append an array to a multidimentional array in >> PL/PGSQL procedure? >> >> EG: >> Array_1 = [][]; >> Array_2 = '{1,2,3,4,5}'; >> >> Result should be : >>Array_1 = {{1,2,3,4,5}}; >> >> >> -- >> Regards : >> Venktesh Guttedar. >> >> > > > -- > Best Wishes, > Chris Travers > > Efficito: Hosted Accounting and ERP. Robust and Flexible. No vendor > lock-in. > http://www.efficito.com/learn_more > -- Regards : Venktesh Guttedar.
[GENERAL] Appending to multidimentional array.
Hello, Is there a way to append an array to a multidimentional array in PL/PGSQL procedure? EG: Array_1 = [][]; Array_2 = '{1,2,3,4,5}'; Result should be : Array_1 = {{1,2,3,4,5}}; -- Regards : Venktesh Guttedar.
[GENERAL] Appending to multidimentional array.
Hello, Is there a way to append an array to a multidimentional array? EG: -- Regards : Venktesh Guttedar.
[GENERAL] Multidimentional array access
Hello, I want to get the inner array in a multi dimentional array in a pl/pgsql procedure. Eg : {{1,2,3,4,5,6,7},{11,22,33,44,55,66,77}} for i in array_lower(Eg, 1) .. array_upper(Eg, 1) LOOP array_value = Eg[i] END LOOP; But Eg[i] is assigning null to array_value Help would be appreciated. -- Regards : Venktesh Guttedar.
[GENERAL] How to loop through multi-dimentional array in PL/PGSQL
Hello, Please help me in accessing multi-dimentional array in postgresql PL/PGSQL. for i in array_lower(product_list, 1) .. array_upper(product_list, 1) LOOP product_list[i][0]; END LOOP; Is the above code right? Or is there any other way to access, i am getting null for product_list[i][0]; Any help would be appreciated. -- Regards : Venktesh Guttedar.
[GENERAL] : Getting error while starting the server
Hello, i have Postgresql 9.3.5 installed and django 1.7 and till now it was working fine. But now i am getting the following error while starting the server to run my app : Unhandled exception in thread started by function check_errors.locals.wrapper at 0xb2da8074 Traceback (most recent call last): File /usr/local/lib/python3.4/dist-packages/django/db/backends/__init__.py, line 133, in ensure_connection self.connect() File /usr/local/lib/python3.4/dist-packages/django/db/backends/__init__.py, line 122, in connect self.connection = self.get_new_connection(conn_params) File /usr/local/lib/python3.4/dist-packages/django/db/backends/postgresql_psycopg2/base.py, line 134, in get_new_connection return Database.connect(**conn_params) File /usr/local/lib/python3.4/dist-packages/psycopg2/__init__.py, line 164, in connect conn = _connect(dsn, connection_factory=connection_factory, async=async) psycopg2.OperationalError: could not translate host name localhost to address: Name or service not known The above exception was the direct cause of the following exception: Traceback (most recent call last): File /usr/local/lib/python3.4/dist-packages/django/utils/autoreload.py, line 222, in wrapper fn(*args, **kwargs) File /usr/local/lib/python3.4/dist-packages/django/core/management/commands/runserver.py, line 107, in inner_run self.check_migrations() File /usr/local/lib/python3.4/dist-packages/django/core/management/commands/runserver.py, line 159, in check_migrations executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS]) File /usr/local/lib/python3.4/dist-packages/django/db/migrations/executor.py, line 17, in __init__ self.loader = MigrationLoader(self.connection) File /usr/local/lib/python3.4/dist-packages/django/db/migrations/loader.py, line 48, in __init__ self.build_graph() File /usr/local/lib/python3.4/dist-packages/django/db/migrations/loader.py, line 183, in build_graph self.applied_migrations = recorder.applied_migrations() File /usr/local/lib/python3.4/dist-packages/django/db/migrations/recorder.py, line 59, in applied_migrations self.ensure_schema() File /usr/local/lib/python3.4/dist-packages/django/db/migrations/recorder.py, line 49, in ensure_schema if self.Migration._meta.db_table in self.connection.introspection.get_table_list(self.connection.cursor()): File /usr/local/lib/python3.4/dist-packages/django/db/backends/__init__.py, line 165, in cursor cursor = self.make_debug_cursor(self._cursor()) File /usr/local/lib/python3.4/dist-packages/django/db/backends/__init__.py, line 138, in _cursor self.ensure_connection() File /usr/local/lib/python3.4/dist-packages/django/db/backends/__init__.py, line 133, in ensure_connection self.connect() File /usr/local/lib/python3.4/dist-packages/django/db/utils.py, line 94, in __exit__ six.reraise(dj_exc_type, dj_exc_value, traceback) File /usr/local/lib/python3.4/dist-packages/django/utils/six.py, line 658, in reraise raise value.with_traceback(tb) File /usr/local/lib/python3.4/dist-packages/django/db/backends/__init__.py, line 133, in ensure_connection self.connect() File /usr/local/lib/python3.4/dist-packages/django/db/backends/__init__.py, line 122, in connect self.connection = self.get_new_connection(conn_params) File /usr/local/lib/python3.4/dist-packages/django/db/backends/postgresql_psycopg2/base.py, line 134, in get_new_connection return Database.connect(**conn_params) File /usr/local/lib/python3.4/dist-packages/psycopg2/__init__.py, line 164, in connect conn = _connect(dsn, connection_factory=connection_factory, async=async) django.db.utils.OperationalError: could not translate host name localhost to address: Name or service not known can anyone tell me what is the reason for this error.? -- Regards : Venktesh Guttedar.
[GENERAL] Storing Video's or vedio file in DB.
Hello, I am using PostGreSQL 9.3.5 and DJango1.7.5 and python 3.3. I am working on a application where i will get video files from mobile app, and i have to store in the server, so my question is how do i store video's or video files in DB, or do i need to store only the link of that video file, if yes then where i have to store the file and how to access that file to display in an html page. if anyone is helping me out then give me all details related to storing videos in db, not just hints. like (what datatype i have to use.? how to encode and decode.? how to accept files through http post) Help would be appreciated. Thank you. -- Regards : Venktesh Guttedar.
[GENERAL] Error : Ensure this value has at most 30 characters (it has 31) django
Hello, I am using DJango 1.7 and Postgresql 9.3.5. I am trying to store email in the username field of django.contrib.auth.models.User. but when i try to store more than 30 characters i am getting this error : Ensure this value has at most 30 characters (it has 31) django i tried changing the max length to 75 of username field of auth_user. but still i am getting the same error. Please help me to solve this -- Regards : Venktesh Guttedar.
[GENERAL] [general] Error while decrypting using pgp
Hello, I am running postgresql 9.3.5 on Ubuntu14.04. i have the table two fields of varchar type. while inserting the data in the following way. INSERT INTO testusers(username, phone_no) SELECT pgp_sym_encrypt(test.username, keys.pubkey), pgp_sym_encrypt(test.phone_no, keys.pubkey) As cc FROM (VALUES ('abcd', '9876543210') ) As test(username, cc) CROSS JOIN (SELECT armor('DC35GT67'') As pubkey) As keys; it is encrypting the data. when i say SELECT * FROM testusers; i get these values. username = \xc30d04070302624fc5146ba1304a63d2360165b2c8c7e5d48cea7673c66f0ddb5ecef4eafe146797b70f4df028a257847e9de6b1eccaf974639b27a01fbb5b42e24f14fb17eba5 phone_no = \xc30d0407030284f6b57ae1c2d57369d23701cd705d5c6da32570c3f0ca9aaf2625a5bfbdcb439959674c6c5be879f8c42fd24ac2eba99648b853e6b37977560f52118c9ee7bb0d49 But when i say SELECT pgp_sym_decrypt(phone_no, keys.privkey), pgp_sym_decrypt(username, keys.privkey) As Phonedecrypt FROM testusers CROSS JOIN (SELECT armor('DC35GT67'') As privkey) As keys; i am getting this error ERROR: function pgp_sym_decrypt(character varying, text) does not exist LINE 1: SELECT pgp_sym_decrypt(phone_no, keys.privkey), pgp_sym_decrypt(us... ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts. Can anyone tell me where i am going wrong. and if not then what explicit type casts i have to add.? please help thanks in advance. -- Regards : Venktesh Guttedar.
[GENERAL] ERROR: Corrupt ascii-armor
Hello, I am running PostgreSQL 9.3.5 on Ubuntu 14.04. i want to encrpty data while storing and decrypt while retrieving it. so i am using pgcrypto to achieve it. i have genrated the keys using gpg --gen-key. and i have exported them to also. I have created the table this way : CREATE TABLE testuserscards(card_id SERIAL PRIMARY KEY, username varchar(100), cc bytea); and when i am trying to insert data : INSERT INTO testuserscards(username, cc)SELECT robotccs.username, pgp_pub_encrypt(robotccs.cc, keys.pubkey) As cc FROM (VALUES ('robby', '4'), ('artoo', '41112') ) As robotccs(username, cc) CROSS JOIN (SELECT dearmor('-BEGIN PGP PUBLIC KEY BLOCK- super publickey goobly gook goes here -END PGP PUBLIC KEY BLOCK-') As pubkey) As keys; i am getting the error as ERROR: Corrupt ascii-armor. please help me to encrypt data.. or is there any other way to achieve safe encryption and decryption.? -- Regards : Venktesh Guttedar.
[GENERAL] [general] Encrypting/Decryption
Hello, As i am new to postgresql and django. please help me to acheive the following. I have created a database with some tables and i want to encrypt the data in database tables, so please someone guide me how to do it.? i want to encrypt the data and also decrypt through django, so tell me which is right way either to use pgcrypto or pycryto, i am not understanding neither of them. please help. -- Regards : Venktesh Guttedar.
[GENERAL] Encrypting/Decryption
Hello, As i am new to postgresql and django. please help me to acheive the following. I have created a database with some tables and i want to encrypt the data in database tables, so please someone guide me how to do it.? i want to encrypt the data and also decrypt through django, so tell me which is right way either to use pgcrypto or pycryto, i am not understanding neither of them. please help. -- Regards : Venktesh Guttedar.
[GENERAL] Retrieving Data from table based on Date and Time.
Hello, I have a table in which i have some few fields, in that few, one field is of date type and second one is of time data type, so now my question is how can i fetch the data with latest date and time, or the last inserted value from the PostgreSQL Table.? -- Regards : Venktesh Guttedar.
Re: [GENERAL] Retrieving Data from table based on Date and Time.
Thanks it helped. On Sat, Nov 1, 2014 at 2:09 PM, Stephen Cook scli...@gmail.com wrote: On 11/1/2014 2:27 AM, VENKTESH GUTTEDAR wrote: I have a table in which i have some few fields, in that few, one field is of date type and second one is of time data type, so now my question is how can i fetch the data with latest date and time, or the last inserted value from the PostgreSQL Table.? SELECT * FROM mytable ORDER BY datecolumn DESC, timecolumn DESC LIMIT 1; You might want to put an index on them. -- Stephen -- Regards : Venktesh Guttedar.
Re: [GENERAL] Appending new data to existing field of Json data type
@Adrian Klaver, Thanks for this idea but still m really confused with how to update the json filed in the DB. is there any way to update the json field in the DB through view.? On Wed, Oct 29, 2014 at 7:37 PM, Adrian Klaver adrian.kla...@aklaver.com wrote: On 10/29/2014 01:06 AM, VENKTESH GUTTEDAR wrote: Ya agreed thats not legal JSON, that was typing mistake sorry for that, let me make you clear what i need exactly, I have table named (exampleTable) with json field as (example_list), and when i say SELECT * FROM exampleTable; id | example_list ---+-- 2 | {abc:[ { a:b,c:d } ] } And this data i am inserting through DJango view by writing the following statement test = ExampleTable(id = 2, example_list = {abc : [ { a:b,c:d } ] }) test.save() now i want to append { e:f, g:h } to example_list by specifying the id. and after appending the data should be stored in the following way : After appending, for example if i say : SELECT * FROM exampleTable; i should get this. id | example_list ---+ 2 | {abc:[ { a:b,c:d }, { e:f, g:h } ] } Hope your clear now. So now Guide me to append it through Python Djnago View. or through raw sql query. If it where me I would bring the data into the view and do the work there in Python using dicts and lists. There is a Python module out there that make this easier to do: https://pypi.python.org/pypi/django-jsonfield -- Regards : Venktesh Guttedar. -- Adrian Klaver adrian.kla...@aklaver.com -- Regards : Venktesh Guttedar.
Re: [GENERAL] Appending new data to existing field of Json data type
Thanks Adrian Klaver, Its really helped me to solve my problem, ya i have example_list = jsonfield.JSONField() in models. Apologies i did not mention that. but anyways thank again. On Thu, Oct 30, 2014 at 8:09 PM, Adrian Klaver adrian.kla...@aklaver.com wrote: On 10/29/2014 11:26 PM, VENKTESH GUTTEDAR wrote: @Adrian Klaver, Thanks for this idea but still m really confused with how to update the json filed in the DB. is there any way to update the json field in the DB through view.? Realized I should have shown at least one concrete example so, assuming you are dealing with Python data structures where: id2.example_list = {abc : [ { a:b,c:d } ] } then id2.example_list[abc].append({ e:f, g:h }) id2.example_list {'abc': [{'a': 'b', 'c': 'd'}, {'e': 'f', 'g': 'h'}]} then Regards : Venktesh Guttedar. -- Adrian Klaver adrian.kla...@aklaver.com -- Regards : Venktesh Guttedar.
[GENERAL] Appending new data to existing field of Json data type
Hello, As i am new to postgresql, i am learning through experimenting things. i have a table with json data type field, so there is some data for example : { [ { a:b, b:c } ] } and now if i append data then it should be like : { [ { a:b, b:c }, { e:f, g:h } ] } Is there any way to achieve this. please help.! I have Postgresql 9.3.5. -- Regards : Venktesh Guttedar.
[GENERAL] Need Guidance on Appending new data to existing field of Json data type
Hello, As i am new to Postgresql, i am learning through experimenting things. i have a table with json data type field, so there is some data for example : { [ { a:b, b:c } ] } and now if i append data then it should be like : { [ { a:b, b:c }, { e:f, g:h } ] } Is there any way to achieve this. please help.! I have Postgresql 9.3.5 -- Regards : Venktesh Guttedar.
Re: [GENERAL] Appending new data to existing field of Json data type
Ya agreed thats not legal JSON, that was typing mistake sorry for that, let me make you clear what i need exactly, I have table named (exampleTable) with json field as (example_list), and when i say SELECT * FROM exampleTable; id | example_list ---+-- 2 | {abc:[ { a:b,c:d } ] } And this data i am inserting through DJango view by writing the following statement test = ExampleTable(id = 2, example_list = {abc : [ { a:b,c:d } ] }) test.save() now i want to append { e:f, g:h } to example_list by specifying the id. and after appending the data should be stored in the following way : After appending, for example if i say : SELECT * FROM exampleTable; i should get this. id | example_list ---+ 2 | {abc:[ { a:b,c:d }, { e:f, g:h } ] } Hope your clear now. So now Guide me to append it through Python Djnago View. or through raw sql query. On Wed, Oct 29, 2014 at 12:45 PM, Michael Paquier michael.paqu...@gmail.com wrote: On Wed, Oct 29, 2014 at 3:42 PM, VENKTESH GUTTEDAR venkteshgutte...@gmail.com wrote: As i am new to postgresql, i am learning through experimenting things. i have a table with json data type field, so there is some data for example : { [ { a:b, b:c } ] } and now if i append data then it should be like : { [ { a:b, b:c }, { e:f, g:h } ] } That's not legal JSON, no? A key needs to be appended for the array defined, like that: =# select '{f1:[{ a:b, b:c }]}'::json; json --- {f1:[{ a:b, b:c }]} (1 row) Is there any way to achieve this. please help.! I have Postgresql 9.3.5. Er, you can use the concatenate operator || to achieve that: =# select '{a:b,b:c}'||','||'{e:f,f:g}'::json; ?column? - {a:b,b:c},{e:f,f:g} (1 row) You may prefer actually something that really merges everything, among many methods here is one (not the fastest one, now on the top of my mind): =# with union_json as ( select * from json_each('{a:b,b:c}'::json) union all select * from json_each('{d:e,e:f}'::json)) select '{'||string_agg(to_json(key)||':'||value, ',')||'}' from union_json; ?column? --- {a:b,b:c,d:e,e:f} (1 row) Regards, -- Michael -- Regards : Venktesh Guttedar.