Questions tagged [postgresql-8.2]

Questions specific to version 8.2 of the widely-used PostgreSQL relational database system

This tag is for questions specific to version 8.2 of the widely-used .

Official documentation for this version: http://www.postgresql.org/docs/8.2/interactive/index.html

For general PostgreSQL questions, use the tag.

42 questions
8
votes
3 answers

Sort timestamps (including future) by absolute distance from "now"

With a date field I can do this: ORDER BY ABS(expiry - CURRENT_DATE) With a timestamp field I get the following error: function abs(interval) does not exist
l0b0
  • 55,365
  • 30
  • 138
  • 223
5
votes
2 answers

Airflow + pandas read_sql_query() with commit

Question Can I commit a SQL transaction to a DB using read_sql()? Use Case and Background I have a use case where I want to allow users to execute some predefined SQL and have a pandas dataframe returned. In some cases, this SQL will need to query a…
Dan
  • 173
  • 1
  • 5
4
votes
3 answers

Get all instances of a substring in a string in PostgreSQL?

I've got a table with entries that are similar to "something XXX010101 somethingelse XXX010102". I'd like to extract the XXX01... parts from them - possibly using some separator if needed - right now I'm able to easily take out the first one…
RnR
  • 2,096
  • 1
  • 15
  • 23
3
votes
1 answer

PostgreSQL 8.2 -- How to get a string representation of any array?

In PostgreSQL8.2, what's the inverse of PostgreSQL's text-to-array conversion? As we know: select '{a,b,c}'::text[] as x, '{{0,1},{2,3}}'::int[][] as y; /* * x | y * ---------+--------------- * {a,b,c} | {{0,1},{2,3}} */ Is there…
Pierre D
  • 24,012
  • 7
  • 60
  • 96
3
votes
2 answers

Numbering rows without window functions

In Postgresql 8.2 I want to sequentially number rows. I have the table t at SQL Fiddle: c --- 3 2 I want this: c | i ---+--- 2 | 1 3 | 2 I tried this: select * from (select c from t order by c) s cross join …
Clodoaldo Neto
  • 118,695
  • 26
  • 233
  • 260
2
votes
1 answer

Finding array length in postgres

I tried array_upper(array(Value)) and array_upper((Value):array[]) but was getting syntax error. Value : data type is int []; I am expecting the result as below table: Pname week_date Value array_length 5773 6/8/2013 {29} …
user2569524
  • 1,651
  • 7
  • 32
  • 57
2
votes
2 answers

PostgreSQL 8.2.9 Enum Type

PostgreSQL from 8.3 knows Enumerated Types. Simple question: Does 8.2(.9) know them too? If not, what can be used as replacement?
grssnbchr
  • 2,877
  • 7
  • 37
  • 71
1
vote
2 answers

Pad arrays with NULL to maximum length for custom aggregate function - no array_fill function

This is almost same question as Pad arrays with NULL to maximum length for custom aggregate function. the only problem with the answer provided is that function array_fill doesn't exist in Postgres 8.2. How can I make it useable given the version I…
fairybetty
  • 57
  • 7
1
vote
1 answer

Dynamic table names by date

So I have tables that I need to generate nightly. As an example I have tables such as foo_01jan16, foo_02jan2016, foo_03jan2016, etc. Additionally I reference these table(s) in other queries that I run daily. However, find and replace seems…
windsormatic
  • 173
  • 1
  • 2
  • 8
1
vote
0 answers

PG_Depend Column Alias (view) to Source Column (table) mapping dependancy

I'm using version 8.2 Postresql Have been trying to do this for days now, and I keep hitting the same wall. How to Display the following: Source Table || Source_column || Target View || Target Column Stg_table1|| customerid || vw_customer …
pixie
  • 283
  • 2
  • 3
  • 10
1
vote
1 answer

Syntax Error near SQLSTATE

I got a plpgsql function here to indicate if any warning raised during ANALYZE: CREATE OR REPLACE FUNCTION analyzeWarning() RETURNS integer AS $$ DECLARE warningRaised int; BEGIN warningRaised := 0; FOR i IN 1..10 LOOP BEGIN …
Xin Zhang
  • 161
  • 1
  • 1
  • 10
1
vote
1 answer

Can I install postgresql8.2 via command prompt or running any batch or registry file?

Is it possible to install the entire database(postgresql8.2) via command prompt or batch file or registry file bypassing the trivial procedure for installation. But then to a question comes that, how can we supply default parameters such as…
Supereme
  • 2,379
  • 12
  • 46
  • 67
1
vote
1 answer

Optimising Select number of rows in PostgreSql for multiple group by fields

I have this query to get number of rows for the given filters, it takes too long time to get the result since db is too big, is there any way to optimise it i'm using postgresql 8.2 SELECT COUNT(1) as numrows from ( select lower(column1) as…
rohitmb
  • 151
  • 1
  • 3
  • 13
1
vote
1 answer

Truncating table before dynamic SQL with looping variables inside of one function

I have a function that loops through specific schema names and inserts data into a table. I would like to be able to truncate said table before the insert loop occurs. I've tried putting the truncate statement inside of the dynamic query and that…
precose
  • 614
  • 1
  • 13
  • 36
1
vote
2 answers

Renumber duplicates to make them unique

Table "public.t" Column | Type | Modifiers --------+---------+----------- code | text | grid | integer | The codigo column, although of type text, has a numeric sequence which has duplicates. The grid column is a unique…
Clodoaldo Neto
  • 118,695
  • 26
  • 233
  • 260
1
2 3