postgresql-8.4

Calling a user-defined function located in “postgres.c” in postgreSQL using a GUI defined by netbeans

瘦欲@ 提交于 2019-12-11 08:58:19
问题 I' trying to add 3 user_defined function to the PostgreSQL-8.4.15. Here are 3 functions: (1) start_create_profile(); (2) make_profile(); (3) check_anomaly(); All of them are written in file "test.c" located in src/backend/tcop. I want to call (1) and (3) from the middle of exec_simple_query() . exec_simple_query() is PostgreSQL function that is written in "postgres.c" located in src/backend/tcop. I want to call (2) directly through my GUI. here is the my code written in "test.c" : #include

Show the count based on some condition

懵懂的女人 提交于 2019-12-11 08:27:35
问题 I've asked a question some days back. Here is that link. Count() corresponding to max() Now with the same set of tables (SQL Fiddle) I would like to check a different condition If the first question was about a count related to the max of a status, this question is about showing the count based on the next status of every project. Explanation As you can see in the table user_approval,appr_prjt_id=1 has 3 different statuses namely 10,20 ,30. And the next status will be 40 (With every approval

Calculate a quotient in one table and store it in another table

此生再无相见时 提交于 2019-12-11 04:33:37
问题 I have a small Facebook card game where users can rate each other. Those ratings are stored in a PostgreSQL 8.4.13 table pref_rep as a boolean value nice , which can be null too: # \d pref_rep; Table "public.pref_rep" Column | Type | Modifiers -----------+-----------------------------+----------------------------------------------------------- id | character varying(32) | not null author | character varying(32) | not null nice | boolean | comment | character varying(256) | rep_id | integer |

SQL - How to check if item is in a list in a record

我与影子孤独终老i 提交于 2019-12-11 03:16:32
问题 I have have a column name MyRoles that contains a list of items (integers) stored in a field named UserRoles. I want to write a query that checks to see if a specific item is in the list. The list will look like this: "1,2,3" I can't use WHERE MyRoles What should the query look like? This is similar to what I am thinking: SELECT * FROM MyTable WHERE MyRoles CONTAINS ('1') The fact that no answer was easy to implement and would take me farther down an ugly road really makes clear that a

locale issue while upgrading data directory from PostgreSQL 8.4 to 9.5

一个人想着一个人 提交于 2019-12-10 18:07:33
问题 I am upgrading PostgreSQL 8.4 to 9.5 on Windows. Following are the steps that are to be followed: Install PostgreSQL 9.5 (8.4 is already installed). Migrate data from 8.4's data dir to 9.5's data dir using pg_upgrade utility. After successful upgrade, uninstall PostgreSQL 8.4 Here the issue is that PostgreSQL 8.4 could be installed with any locale (English or French etc.) and to have successful data directory upgrade, PostgreSQL 9.5 must be installed with the same locale as that of 8.4.

GROUP_CONCAT for similar records in PostgreSQL

杀马特。学长 韩版系。学妹 提交于 2019-12-10 17:44:12
问题 I have a the following query in PostgreSQL: SELECT sale_order.id,sale_order.name AS orden, now()::date AS hoy, sale_order.create_date::date, split_part(res_partner.name,' ',1) AS cliente, res_partner.email,sale_order.amount_total,res_currency.name FROM sale_order,product_pricelist,res_currency,res_partner WHERE sale_order.partner_id = res_partner.id AND sale_order.pricelist_id = product_pricelist.id AND product_pricelist.currency_id = res_currency.id AND sale_order.state = 'sent' ORDER BY

Find PostgreSQL server hostname on which it runs

余生颓废 提交于 2019-12-10 11:34:20
问题 Is it possible to find the host on which the PostgreSQL Server runs ? 回答1: Use SELECT inet_server_addr() , but it'll return NULL if connection is established via Unix-domain socket. And there's inet_server_port() which returns the port server is listening. 来源: https://stackoverflow.com/questions/14039101/find-postgresql-server-hostname-on-which-it-runs

Sending empty values with PDO results in error

北慕城南 提交于 2019-12-10 11:09:38
问题 We have something like the following PDO Statement which we use to communicate with a PostgreSQL 8.4 DB. $st = $db -> prepare("INSERT INTO Saba.Betriebskosten (personalkosten) VALUES(:kd_personalkosten)"); $st -> bindParam(':kd_personalkosten', $val['kd_personalkosten']); $val['kd_personalkosten'] is either empty/null or contains a double value. In the case it is empty/null, we just want to insert an empty value, but we receive the following error: SQLSTATE[22P02]: Invalid text representation

substring regex for first part of url

穿精又带淫゛_ 提交于 2019-12-08 11:33:25
问题 I've got a large database of projects and issue trackers, some of which have urls. I'd like to query it to figure out a list of urls for each project, but many have extra data I'd like to avoid. I'd like to do something like this: substring(tracker_extra_field_data.field_data FROM 'http://([^/]*).*') Except some urls are https, and I'd like to capture that as well as the first sub directory. For example, given the url: https://dev.foo.com/bar/action/?param=val I'd like the select to return:

Chosing the right index for PostgreSQL query

痴心易碎 提交于 2019-12-07 12:30:21
问题 Simplified table: CREATE TABLE products ( product_no integer PRIMARY KEY, sales integer, status varchar(16), category varchar(16)); CREATE INDEX index_products_sales ON products (sales); CREATE INDEX index_products_status ON products (status); CREATE INDEX index_products_category ON products (category); PostgreSQL version is 8.4. Columns 'status' and 'category' There are 20 million products/rows spread across 15 categories. One of the most used queries is getting the three most sold products,